1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 22:02:05 +02:00

fix webkit modify styles for read-only mode, closes #137

This commit is contained in:
Ian Storm Taylor 2016-07-20 14:46:44 -07:00
parent 00ee5c3c70
commit a0cd5364c1
2 changed files with 8 additions and 7 deletions

View File

@ -17,7 +17,7 @@ class ReadOnly extends React.Component {
*/
state = {
state: Plain.deserialize('This is read-only text. You should not be able to edit it, which is useful for scenarios where you want to render via Slate, without giving the user editing persmissions.')
state: Plain.deserialize('This is read-only text. You should not be able to edit it, which is useful for scenarios where you want to render via Slate, without giving the user editing permissions.')
};
/**

View File

@ -399,17 +399,18 @@ class Content extends React.Component {
.map(node => this.renderNode(node))
.toArray()
const style = {
...this.props.style,
// COMPAT: Prevent iOS from showing the BIU formatting menu, which causes
// the internal state to get out of sync in weird ways.
WebkitUserModify: 'read-write-plaintext-only',
let style = {
// Prevent the default outline styles.
outline: 'none',
// Preserve adjacent whitespace and new lines.
whiteSpace: 'pre-wrap',
// Allow words to break if they are too long.
wordWrap: 'break-word'
wordWrap: 'break-word',
// COMPAT: Prevent iOS from showing the BIU formatting menu, which causes
// the internal state to get out of sync in weird ways.
...(readOnly ? {} : { WebkitUserModify: 'read-write-plaintext-only' }),
// Allow for passed-in styles to override anything.
...this.props.style,
}
return (