tabs to spaces whitespace
This commit is contained in:
@@ -3,35 +3,35 @@ import { history, undo, redo } from 'prosemirror-history'
|
||||
|
||||
export default class History extends Extension {
|
||||
|
||||
get name() {
|
||||
return 'history'
|
||||
}
|
||||
get name() {
|
||||
return 'history'
|
||||
}
|
||||
|
||||
keys() {
|
||||
const isMac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false
|
||||
const keymap = {
|
||||
'Mod-z': undo,
|
||||
'Shift-Mod-z': redo,
|
||||
}
|
||||
keys() {
|
||||
const isMac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false
|
||||
const keymap = {
|
||||
'Mod-z': undo,
|
||||
'Shift-Mod-z': redo,
|
||||
}
|
||||
|
||||
if (!isMac) {
|
||||
keymap['Mod-y'] = redo
|
||||
}
|
||||
if (!isMac) {
|
||||
keymap['Mod-y'] = redo
|
||||
}
|
||||
|
||||
return keymap
|
||||
}
|
||||
return keymap
|
||||
}
|
||||
|
||||
get plugins() {
|
||||
return [
|
||||
history(),
|
||||
]
|
||||
}
|
||||
get plugins() {
|
||||
return [
|
||||
history(),
|
||||
]
|
||||
}
|
||||
|
||||
commands() {
|
||||
return {
|
||||
undo: () => undo,
|
||||
redo: () => redo,
|
||||
}
|
||||
}
|
||||
commands() {
|
||||
return {
|
||||
undo: () => undo,
|
||||
redo: () => redo,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,40 +3,40 @@ import { Decoration, DecorationSet } from 'prosemirror-view'
|
||||
|
||||
export default class Placeholder extends Extension {
|
||||
|
||||
get name() {
|
||||
return 'placeholder'
|
||||
}
|
||||
get name() {
|
||||
return 'placeholder'
|
||||
}
|
||||
|
||||
get defaultOptions() {
|
||||
return {
|
||||
emptyNodeClass: 'is-empty',
|
||||
}
|
||||
}
|
||||
get defaultOptions() {
|
||||
return {
|
||||
emptyNodeClass: 'is-empty',
|
||||
}
|
||||
}
|
||||
|
||||
get plugins() {
|
||||
return [
|
||||
new Plugin({
|
||||
props: {
|
||||
decorations: ({ doc }) => {
|
||||
const decorations = []
|
||||
const completelyEmpty = doc.textContent === '' && doc.childCount <= 1 && doc.content.size <= 2
|
||||
get plugins() {
|
||||
return [
|
||||
new Plugin({
|
||||
props: {
|
||||
decorations: ({ doc }) => {
|
||||
const decorations = []
|
||||
const completelyEmpty = doc.textContent === '' && doc.childCount <= 1 && doc.content.size <= 2
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (!completelyEmpty) {
|
||||
return
|
||||
}
|
||||
doc.descendants((node, pos) => {
|
||||
if (!completelyEmpty) {
|
||||
return
|
||||
}
|
||||
|
||||
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
||||
class: this.options.emptyNodeClass,
|
||||
})
|
||||
decorations.push(decoration)
|
||||
})
|
||||
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
||||
class: this.options.emptyNodeClass,
|
||||
})
|
||||
decorations.push(decoration)
|
||||
})
|
||||
|
||||
return DecorationSet.create(doc, decorations)
|
||||
},
|
||||
},
|
||||
}),
|
||||
]
|
||||
}
|
||||
return DecorationSet.create(doc, decorations)
|
||||
},
|
||||
},
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user