Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues in IE 11 #1756

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/slate-html-serializer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class Html {
*/

deserialize = (html, options = {}) => {
// Provides default value to make it working in IE 11.
Copy link

@sethmcleod sethmcleod Apr 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update this comment to something along these lines: COMPAT: Provide a default value for IE11 support

html = html || '<p></p>'
const { toJSON = false } = options
const { defaultBlock, parseHtml } = this
const fragment = parseHtml(html)
Expand Down Expand Up @@ -327,8 +329,8 @@ class Html {
const { document } = value
const elements = document.nodes.map(this.serializeNode).filter(el => el)
if (options.render === false) return elements

const html = renderToStaticMarkup(<body>{elements}</body>)
// Converts List to Array to support IE 11.
Copy link

@sethmcleod sethmcleod Apr 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this and similar comments be updated to say COMPAT: Converts List to Array for IE11 support for consistency with other compatibility comments?

const html = renderToStaticMarkup(<body>{elements.toArray()}</body>)
const inner = html.slice(6, -7)
return inner
}
Expand All @@ -343,14 +345,17 @@ class Html {
serializeNode = node => {
if (node.object === 'text') {
const leaves = node.getLeaves()
return leaves.map(this.serializeLeaf)
const children = leaves.map(this.serializeLeaf);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this semicolon needs to be removed.

// Converts List to Array to support IE 11.
return children.toArray()
}

const children = node.nodes.map(this.serializeNode)

for (const rule of this.rules) {
if (!rule.serialize) continue
const ret = rule.serialize(node, children)
// Converts List to Array to support IE 11.
const ret = rule.serialize(node, children.toArray())
if (ret === null) return
if (ret) return addKey(ret)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/slate-react/src/components/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ class Text extends React.Component {
return child
})

// Converts List to Array to support IE 11.
return (
<span data-key={key} style={style}>
{children}
{children.toArray()}
</span>
)
}
Expand Down