Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Warn visibly when extensions break Draft
Browse files Browse the repository at this point in the history
Summary: Content to be finalized, but I think this suffices for an employee test.

Reviewed By: flarnie

Differential Revision: D9492642

fbshipit-source-id: bf8cbcc1d590ab27643d2b4b9d3cf4171d3409a1
  • Loading branch information
sophiebits authored and facebook-github-bot committed Aug 24, 2018
1 parent 9f86efb commit c0fb6a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/component/base/DraftEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DraftEditorContents = require('DraftEditorContents.react');
const DraftEditorDragHandler = require('DraftEditorDragHandler');
const DraftEditorEditHandler = require('DraftEditorEditHandler');
const DraftEditorPlaceholder = require('DraftEditorPlaceholder.react');
const DraftODS = require('DraftODS');
const DraftEffects = require('DraftEffects');
const EditorState = require('EditorState');
const React = require('React');
const ReactDOM = require('ReactDOM');
Expand Down Expand Up @@ -431,7 +431,7 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
this._blockSelectEvents = false;
if (!didInitODS && gkx('draft_ods_enabled')) {
didInitODS = true;
DraftODS.init();
DraftEffects.initODS();
}
this.setMode('edit');

Expand Down
2 changes: 2 additions & 0 deletions src/component/selection/setDraftEditorSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import type SelectionState from 'SelectionState';

const DraftEffects = require('DraftEffects');
const DraftJsDebugLogging = require('DraftJsDebugLogging');

const containsNode = require('containsNode');
Expand Down Expand Up @@ -323,6 +324,7 @@ function addPointToSelection(
extraParams: JSON.stringify({offset: offset}),
selectionState: JSON.stringify(selectionState.toJS()),
});
DraftEffects.handleExtensionCausedError();
}
range.setStart(node, offset);
selection.addRange(range);
Expand Down
3 changes: 2 additions & 1 deletion src/stubs/DraftODS.js → src/stubs/DraftEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
'use strict';

module.exports = {
init: function() {},
initODS: function() {},
handleExtensionCausedError: function() {},
};

0 comments on commit c0fb6a8

Please sign in to comment.