add base extension

This commit is contained in:
Philipp Kühn
2018-08-24 08:41:41 +02:00
parent 5ec4b6da8c
commit d60e69e822
4 changed files with 39 additions and 42 deletions

View File

@@ -1,3 +1,4 @@
export { default as Editor } from './components/editor' export { default as Editor } from './components/editor'
export { default as Extension } from './utils/extension'
export { default as Node } from './utils/node' export { default as Node } from './utils/node'
export { default as Mark } from './utils/mark' export { default as Mark } from './utils/mark'

View File

@@ -0,0 +1,30 @@
export default class Extension {
constructor(options = {}) {
this.options = {
...this.defaultOptions,
...options,
}
}
get name() {
return null
}
get type() {
return 'extension'
}
get defaultOptions() {
return {}
}
get plugins() {
return []
}
inputRules() {
return []
}
}

View File

@@ -1,18 +1,9 @@
export default class Mark { import Extension from './extension'
export default class Mark extends Extension {
constructor(options = {}) { constructor(options = {}) {
this.options = { super(options)
...this.defaultOptions,
...options,
}
}
get name() {
return null
}
get defaultOptions() {
return {}
} }
get type() { get type() {
@@ -27,10 +18,6 @@ export default class Mark {
return null return null
} }
get plugins() {
return []
}
command() { command() {
return () => {} return () => {}
} }
@@ -39,8 +26,4 @@ export default class Mark {
return {} return {}
} }
inputRules() {
return []
}
} }

View File

@@ -1,18 +1,9 @@
export default class Node { import Extension from './extension'
export default class Node extends Extension {
constructor(options = {}) { constructor(options = {}) {
this.options = { super(options)
...this.defaultOptions,
...options,
}
}
get name() {
return null
}
get defaultOptions() {
return {}
} }
get type() { get type() {
@@ -27,10 +18,6 @@ export default class Node {
return null return null
} }
get plugins() {
return []
}
command() { command() {
return () => {} return () => {}
} }
@@ -39,8 +26,4 @@ export default class Node {
return {} return {}
} }
inputRules() {
return []
}
} }