Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into iframe-compatibility
  • Loading branch information
acusti committed Oct 30, 2017
commit a440f391bbfee5efbb811bdcde728400ab10f19c
17 changes: 7 additions & 10 deletions src/component/base/DraftEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,11 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
* ie9-beta-minor-change-list.aspx
*/
if (isIE) {
ReactDOM.findDOMNode(this.refs.editor)
.ownerDocument.execCommand('AutoUrlDetect', false, false);
ReactDOM.findDOMNode(this.refs.editor).ownerDocument.execCommand(
'AutoUrlDetect',
false,
false,
);
}
}

Expand Down Expand Up @@ -378,10 +381,7 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
const scrollParent = Style.getScrollParent(editorNode);
const {x, y} = scrollPosition || getScrollPosition(scrollParent);

invariant(
editorNode.nodeType === 1,
'editorNode is not an Element',
);
invariant(editorNode.nodeType === 1, 'editorNode is not an Element');
editorNode.focus();

// Restore scroll position
Expand All @@ -405,10 +405,7 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {

_blur(): void {
const editorNode = ReactDOM.findDOMNode(this.editor);
invariant(
editorNode.nodeType === 1,
'editorNode is not an Element',
);
invariant(editorNode.nodeType === 1, 'editorNode is not an Element');
editorNode.blur();
}

Expand Down
35 changes: 11 additions & 24 deletions src/model/encoding/convertFromHTMLToContentBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,11 @@ function processInlineTag(
currentStyle = currentStyle.add(styleToCheck).toOrderedSet();
} else if (node.nodeType === 1) {
const htmlElement: HTMLElement = (node: any);
currentStyle = currentStyle.withMutations(style => {
const fontWeight = htmlElement.style.fontWeight;
const fontStyle = htmlElement.style.fontStyle;
const textDecoration = htmlElement.style.textDecoration;
currentStyle = currentStyle
.withMutations(style => {
const fontWeight = htmlElement.style.fontWeight;
const fontStyle = htmlElement.style.fontStyle;
const textDecoration = htmlElement.style.textDecoration;

if (boldValues.indexOf(fontWeight) >= 0) {
style.add('BOLD');
Expand Down Expand Up @@ -295,10 +296,7 @@ function containsSemanticBlockMarkup(
}

function hasValidLinkText(link: Node): boolean {
invariant(
link.nodeName === 'A',
'Link must be an HTMLAnchorElement.',
);
invariant(link.nodeName === 'A', 'Link must be an HTMLAnchorElement.');

const element: HTMLAnchorElement = (link: any);
return (
Expand Down Expand Up @@ -374,7 +372,7 @@ function genFragment(
) {
const entityConfig = {};

imgAttr.forEach((attr) => {
imgAttr.forEach(attr => {
const imageAttribute = image.getAttribute(attr);
if (imageAttribute) {
entityConfig[attr] = imageAttribute;
Expand All @@ -388,11 +386,7 @@ function genFragment(
node.textContent = '\ud83d\udcf7';

// TODO: update this when we remove DraftEntity entirely
inEntity = DraftEntity.__create(
'IMAGE',
'MUTABLE',
entityConfig || {},
);
inEntity = DraftEntity.__create('IMAGE', 'MUTABLE', entityConfig || {});
}
}

Expand Down Expand Up @@ -441,13 +435,10 @@ function genFragment(
entityId = null;
if (nodeName === 'a') {
const anchor: HTMLAnchorElement = (child: any);
if (
anchor.href &&
hasValidLinkText(anchor)
) {
if (anchor.href && hasValidLinkText(anchor)) {
const entityConfig = {};

anchorAttr.forEach((attr) => {
anchorAttr.forEach(attr => {
const anchorAttribute = anchor.getAttribute(attr);
if (anchorAttribute) {
entityConfig[attr] = anchorAttribute;
Expand All @@ -456,11 +447,7 @@ function genFragment(

entityConfig.url = new URI(anchor.href).toString();
// TODO: update this when we remove DraftEntity completely
entityId = DraftEntity.__create(
'LINK',
'MUTABLE',
entityConfig || {},
);
entityId = DraftEntity.__create('LINK', 'MUTABLE', entityConfig || {});
}
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.