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:
parent
00ee5c3c70
commit
a0cd5364c1
@ -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.')
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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 (
|
||||
|
Loading…
x
Reference in New Issue
Block a user