refactoring
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
"@gridsome/transformer-json": "^0.2.1",
|
||||
"@gridsome/vue-remark": "^0.1.10",
|
||||
"@noxify/gridsome-plugin-remark-embed": "^1.1.5",
|
||||
"@types/node": "^13.7.7",
|
||||
"@types/prosemirror-commands": "^1.0.1",
|
||||
"@types/prosemirror-history": "^1.0.1",
|
||||
"@types/prosemirror-inputrules": "^1.0.2",
|
||||
|
||||
@@ -8,10 +8,6 @@ import {addListNodes} from "prosemirror-schema-list"
|
||||
// @ts-ignore
|
||||
import {exampleSetup} from "prosemirror-example-setup"
|
||||
|
||||
import insertText from './commands/insertText'
|
||||
import insertHTML from './commands/insertHTML'
|
||||
import focus from './commands/focus'
|
||||
|
||||
import elementFromString from './utils/elementFromString'
|
||||
|
||||
type EditorContent = string | JSON
|
||||
@@ -39,9 +35,9 @@ export class Editor {
|
||||
constructor(options: EditorOptions) {
|
||||
this.options = options
|
||||
this.view = this.createView()
|
||||
this.registerCommand('focus', focus)
|
||||
this.registerCommand('insertText', insertText)
|
||||
this.registerCommand('insertHTML', insertHTML)
|
||||
this.registerCommand('focus', require('./commands/focus').default)
|
||||
this.registerCommand('insertText', require('./commands/insertText').default)
|
||||
this.registerCommand('insertHTML', require('./commands/insertHTML').default)
|
||||
}
|
||||
|
||||
get state() {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
export default function elementFromString(value: string): HTMLDivElement {
|
||||
const element = document.createElement('div')
|
||||
element.innerHTML = value.trim()
|
||||
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
// console.log('lol')
|
||||
// next()
|
||||
// })
|
||||
// .focus('end')
|
||||
.focus('end')
|
||||
// .insertText('mega ')
|
||||
// .focus('start')
|
||||
// .command('insertText', 'giga ')
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
|
||||
@@ -2057,7 +2057,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
|
||||
|
||||
"@types/node@*", "@types/node@>= 8":
|
||||
"@types/node@*", "@types/node@>= 8", "@types/node@^13.7.7":
|
||||
version "13.7.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.7.tgz#1628e6461ba8cc9b53196dfeaeec7b07fa6eea99"
|
||||
integrity sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==
|
||||
|
||||
Reference in New Issue
Block a user