forked from Gitlink/forgeplus-react
35 lines
635 B
JavaScript
35 lines
635 B
JavaScript
/*
|
|
* @Description: 填空
|
|
* @Author: tangjiang
|
|
* @Github:
|
|
* @Date: 2020-01-06 09:02:29
|
|
* @LastEditors : tangjiang
|
|
* @LastEditTime : 2020-02-05 10:44:01
|
|
*/
|
|
|
|
import Quill from "quill"
|
|
|
|
const InlineBlot = Quill.import('blots/inline')
|
|
const Prop = 'data-index'
|
|
class FillBlot extends InlineBlot {
|
|
|
|
static create(value) {
|
|
const node = super.create()
|
|
node.setAttribute(Prop, value.data_index);
|
|
node.innerText = value.text;
|
|
return node;
|
|
}
|
|
|
|
static value(node) {
|
|
return {
|
|
fill_index: node.getAttribute(Prop)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
FillBlot.blotName = "fill";
|
|
FillBlot.tagName = "span";
|
|
|
|
export default FillBlot;
|