<gh_stars>0
{"ast":null,"code":"/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandUndo(e, editorState, updateFn) {\n  var undoneState = EditorState.undo(editorState); // If the last change to occur was a spellcheck change, allow the undo\n  // event to fall through to the browser. This allows the browser to record\n  // the unwanted change, which should soon lead it to learn not to suggest\n  // the correction again.\n\n  if (editorState.getLastChangeType() === 'spellcheck-change') {\n    var nativelyRenderedContent = undoneState.getCurrentContent();\n    updateFn(EditorState.set(undoneState, {\n      nativelyRenderedContent: nativelyRenderedContent\n    }));\n    return;\n  } // Otheriwse, manage the undo behavior manually.\n\n\n  e.preventDefault();\n\n  if (!editorState.getNativelyRenderedContent()) {\n    updateFn(undoneState);\n    return;\n  } // Trigger a re-render with the current content state to ensure that the\n  // component tree has up-to-date props for comparison.\n\n\n  updateFn(EditorState.set(editorState, {\n    nativelyRenderedContent: null\n  })); // Wait to ensure that the re-render has occurred before performing\n  // the undo action.\n\n  setTimeout(function () {\n    updateFn(undoneState);\n  }, 0);\n}\n\nmodule.exports = keyCommandUndo;","map":{"version":3,"sources":["C:/Users/PC/Desktop/react-project/node_modules/draft-js/lib/keyCommandUndo.js"],"names":["EditorState","require","keyCommandUndo","e","editorState","updateFn","undoneState","undo","getLastChangeType","nativelyRenderedContent","getCurrentContent","set","preventDefault","getNativelyRenderedContent","setTimeout","module","exports"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,WAAW,GAAGC,OAAO,CAAC,eAAD,CAAzB;;AAEA,SAASC,cAAT,CAAwBC,CAAxB,EAA2BC,WAA3B,EAAwCC,QAAxC,EAAkD;AAChD,MAAIC,WAAW,GAAGN,WAAW,CAACO,IAAZ,CAAiBH,WAAjB,CAAlB,CADgD,CACC;AACjD;AACA;AACA;;AAEA,MAAIA,WAAW,CAACI,iBAAZ,OAAoC,mBAAxC,EAA6D;AAC3D,QAAIC,uBAAuB,GAAGH,WAAW,CAACI,iBAAZ,EAA9B;AACAL,IAAAA,QAAQ,CAACL,WAAW,CAACW,GAAZ,CAAgBL,WAAhB,EAA6B;AACpCG,MAAAA,uBAAuB,EAAEA;AADW,KAA7B,CAAD,CAAR;AAGA;AACD,GAZ+C,CAY9C;;;AAGFN,EAAAA,CAAC,CAACS,cAAF;;AAEA,MAAI,CAACR,WAAW,CAACS,0BAAZ,EAAL,EAA+C;AAC7CR,IAAAA,QAAQ,CAACC,WAAD,CAAR;AACA;AACD,GApB+C,CAoB9C;AACF;;;AAGAD,EAAAA,QAAQ,CAACL,WAAW,CAACW,GAAZ,CAAgBP,WAAhB,EAA6B;AACpCK,IAAAA,uBAAuB,EAAE;AADW,GAA7B,CAAD,CAAR,CAxBgD,CA0B3C;AACL;;AAEAK,EAAAA,UAAU,CAAC,YAAY;AACrBT,IAAAA,QAAQ,CAACC,WAAD,CAAR;AACD,GAFS,EAEP,CAFO,CAAV;AAGD;;AAEDS,MAAM,CAACC,OAAP,GAAiBd,cAAjB","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * \n * @emails oncall+draft_js\n */\n'use strict';\n\nvar EditorState = require(\"./EditorState\");\n\nfunction keyCommandUndo(e, editorState, updateFn) {\n  var undoneState = EditorState.undo(editorState); // If the last change to occur was a spellcheck change, allow the undo\n  // event to fall through to the browser. This allows the browser to record\n  // the unwanted change, which should soon lead it to learn not to suggest\n  // the correction again.\n\n  if (editorState.getLastChangeType() === 'spellcheck-change') {\n    var nativelyRenderedContent = undoneState.getCurrentContent();\n    updateFn(EditorState.set(undoneState, {\n      nativelyRenderedContent: nativelyRenderedContent\n    }));\n    return;\n  } // Otheriwse, manage the undo behavior manually.\n\n\n  e.preventDefault();\n\n  if (!editorState.getNativelyRenderedContent()) {\n    updateFn(undoneState);\n    return;\n  } // Trigger a re-render with the current content state to ensure that the\n  // component tree has up-to-date props for comparison.\n\n\n  updateFn(EditorState.set(editorState, {\n    nativelyRenderedContent: null\n  })); // Wait to ensure that the re-render has occurred before performing\n  // the undo action.\n\n  setTimeout(function () {\n    updateFn(undoneState);\n  }, 0);\n}\n\nmodule.exports = keyCommandUndo;"]},"metadata":{},"sourceType":"script"}