@aomao/plugin-mark-range
Advanced tools
+2
-1
@@ -1,2 +0,2 @@ | ||
| import { MarkPlugin, NodeInterface, RangeInterface, SchemaMark, PluginOptions, Path } from '@aomao/engine'; | ||
| import { MarkPlugin, NodeInterface, RangeInterface, SchemaMark, PluginOptions, Path, Node as ModelNode } from '@aomao/engine'; | ||
| export interface MarkRangeOptions extends PluginOptions { | ||
@@ -27,2 +27,3 @@ keys: Array<string>; | ||
| parseValue: (node: NodeInterface, atts: Record<string, string>) => void; | ||
| parseNode: (node: ModelNode) => void; | ||
| onAfterSetValue: () => void; | ||
@@ -29,0 +30,0 @@ schema(): SchemaMark[]; |
+10
-0
@@ -96,2 +96,10 @@ import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2'; | ||
| _this.parseNode = function (node) { | ||
| var key = node[_this.MARK_KEY]; | ||
| if (!!key) { | ||
| node[DATA_TRANSIENT_ATTRIBUTES] = _this.getPreviewName(key); | ||
| } | ||
| }; | ||
| _this.onAfterSetValue = function () { | ||
@@ -198,2 +206,3 @@ var editor = _this.editor; | ||
| editor.on('parse:value', this.parseValue); | ||
| editor.on('parse:node', this.parseNode); | ||
| editor.on('afterSetValue', this.onAfterSetValue); | ||
@@ -930,2 +939,3 @@ var keys = optionKeys.map(function (key) { | ||
| editor.off('parse:value', this.parseValue); | ||
| editor.off('parse:node', this.parseNode); | ||
| editor.off('afterSetValue', this.onAfterSetValue); | ||
@@ -932,0 +942,0 @@ } else if (isView(editor)) { |
+10
-0
@@ -280,2 +280,10 @@ 'use strict'; | ||
| _this.parseNode = function (node) { | ||
| var key = node[_this.MARK_KEY]; | ||
| if (!!key) { | ||
| node[engine.DATA_TRANSIENT_ATTRIBUTES] = _this.getPreviewName(key); | ||
| } | ||
| }; | ||
| _this.onAfterSetValue = function () { | ||
@@ -382,2 +390,3 @@ var editor = _this.editor; | ||
| editor.on('parse:value', this.parseValue); | ||
| editor.on('parse:node', this.parseNode); | ||
| editor.on('afterSetValue', this.onAfterSetValue); | ||
@@ -1114,2 +1123,3 @@ var keys = optionKeys.map(function (key) { | ||
| editor.off('parse:value', this.parseValue); | ||
| editor.off('parse:node', this.parseNode); | ||
| editor.off('afterSetValue', this.onAfterSetValue); | ||
@@ -1116,0 +1126,0 @@ } else if (engine.isView(editor)) { |
+2
-2
| { | ||
| "name": "@aomao/plugin-mark-range", | ||
| "version": "2.10.0", | ||
| "version": "2.10.1", | ||
| "description": "范围标记", | ||
@@ -33,3 +33,3 @@ "publishConfig": { | ||
| }, | ||
| "gitHead": "de7d34813cb5a37233cb68d7ad95a7f9dbc95d33" | ||
| "gitHead": "ccc11648fac5e544f614bc9ac799025728a183a7" | ||
| } |
+10
-0
@@ -24,2 +24,3 @@ import { | ||
| Path, | ||
| Node as ModelNode, | ||
| } from '@aomao/engine'; | ||
@@ -110,2 +111,3 @@ | ||
| editor.on('parse:value', this.parseValue); | ||
| editor.on('parse:node', this.parseNode); | ||
| editor.on('afterSetValue', this.onAfterSetValue); | ||
@@ -167,2 +169,9 @@ const keys = optionKeys.map((key) => this.getPreviewName(key)); | ||
| parseNode = (node: ModelNode) => { | ||
| const key = node[this.MARK_KEY]; | ||
| if (!!key) { | ||
| node[DATA_TRANSIENT_ATTRIBUTES] = this.getPreviewName(key); | ||
| } | ||
| }; | ||
| onAfterSetValue = () => { | ||
@@ -948,2 +957,3 @@ const editor = this.editor; | ||
| editor.off('parse:value', this.parseValue); | ||
| editor.off('parse:node', this.parseNode); | ||
| editor.off('afterSetValue', this.onAfterSetValue); | ||
@@ -950,0 +960,0 @@ } else if (isView(editor)) { |
109142
0.83%2785
0.94%