@visactor/vrender-core 0.21.5-vstory.1 → 0.21.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/cjs/animate/Ticker/default-ticker.d.ts +0 -2
  2. package/cjs/animate/Ticker/default-ticker.js +1 -7
  3. package/cjs/animate/Ticker/default-ticker.js.map +1 -1
  4. package/cjs/animate/animate.js +1 -1
  5. package/cjs/animate/animate.js.map +1 -1
  6. package/cjs/animate/easing.d.ts +0 -4
  7. package/cjs/animate/easing.js +1 -12
  8. package/cjs/animate/easing.js.map +1 -1
  9. package/cjs/animate/index.d.ts +0 -1
  10. package/cjs/animate/index.js +1 -1
  11. package/cjs/animate/index.js.map +1 -1
  12. package/cjs/color-string/store.js +2 -1
  13. package/cjs/common/3d-interceptor.js +1 -2
  14. package/cjs/common/bezier-utils.d.ts +0 -3
  15. package/cjs/common/bezier-utils.js +2 -17
  16. package/cjs/common/bezier-utils.js.map +1 -1
  17. package/cjs/common/custom-path2d.d.ts +0 -4
  18. package/cjs/common/custom-path2d.js +11 -43
  19. package/cjs/common/custom-path2d.js.map +1 -1
  20. package/cjs/common/render-area.js +1 -0
  21. package/cjs/common/render-command-list.js +1 -2
  22. package/cjs/common/segment/curve/arc.d.ts +1 -4
  23. package/cjs/common/segment/curve/arc.js +1 -10
  24. package/cjs/common/segment/curve/arc.js.map +1 -1
  25. package/cjs/common/segment/curve/base.d.ts +1 -4
  26. package/cjs/common/segment/curve/base.js.map +1 -1
  27. package/cjs/common/segment/curve/cubic-bezier.d.ts +1 -5
  28. package/cjs/common/segment/curve/cubic-bezier.js +3 -24
  29. package/cjs/common/segment/curve/cubic-bezier.js.map +1 -1
  30. package/cjs/common/segment/curve/curve-context.js +4 -5
  31. package/cjs/common/segment/curve/curve-context.js.map +1 -1
  32. package/cjs/common/segment/curve/ellipse.d.ts +1 -4
  33. package/cjs/common/segment/curve/ellipse.js +0 -9
  34. package/cjs/common/segment/curve/ellipse.js.map +1 -1
  35. package/cjs/common/segment/curve/line.d.ts +1 -4
  36. package/cjs/common/segment/curve/line.js +0 -18
  37. package/cjs/common/segment/curve/line.js.map +1 -1
  38. package/cjs/common/segment/curve/move.d.ts +1 -4
  39. package/cjs/common/segment/curve/move.js +0 -9
  40. package/cjs/common/segment/curve/move.js.map +1 -1
  41. package/cjs/common/segment/curve/path.d.ts +1 -2
  42. package/cjs/common/segment/curve/path.js +2 -5
  43. package/cjs/common/segment/curve/path.js.map +1 -1
  44. package/cjs/common/segment/curve/quadratic-bezier.d.ts +2 -6
  45. package/cjs/common/segment/curve/quadratic-bezier.js +5 -23
  46. package/cjs/common/segment/curve/quadratic-bezier.js.map +1 -1
  47. package/cjs/common/store.js +1 -1
  48. package/cjs/graphic/builtin-symbol/rect.d.ts +1 -2
  49. package/cjs/graphic/builtin-symbol/rect.js +0 -28
  50. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  51. package/cjs/graphic/builtin-symbol/utils.d.ts +1 -2
  52. package/cjs/graphic/builtin-symbol/utils.js +0 -5
  53. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  54. package/cjs/graphic/config.js +1 -6
  55. package/cjs/graphic/config.js.map +1 -1
  56. package/cjs/graphic/graphic.js +1 -2
  57. package/cjs/graphic/graphic.js.map +1 -1
  58. package/cjs/graphic/richtext/wrapper.d.ts +0 -1
  59. package/cjs/graphic/richtext/wrapper.js +1 -1
  60. package/cjs/graphic/richtext/wrapper.js.map +1 -1
  61. package/cjs/graphic/richtext.js +1 -2
  62. package/cjs/graphic/richtext.js.map +1 -1
  63. package/cjs/index.d.ts +0 -1
  64. package/cjs/index.js +1 -1
  65. package/cjs/index.js.map +1 -1
  66. package/cjs/interface/animate.d.ts +39 -5
  67. package/cjs/interface/animate.js.map +1 -1
  68. package/cjs/interface/graphic/path.d.ts +0 -1
  69. package/cjs/interface/graphic/path.js.map +1 -1
  70. package/cjs/interface/graphic/symbol.d.ts +0 -2
  71. package/cjs/interface/graphic/symbol.js.map +1 -1
  72. package/cjs/interface/graphic.d.ts +2 -6
  73. package/cjs/interface/graphic.js.map +1 -1
  74. package/cjs/interface/path.d.ts +0 -5
  75. package/cjs/interface/path.js.map +1 -1
  76. package/cjs/interface/picker.d.ts +0 -13
  77. package/cjs/interface/picker.js.map +1 -1
  78. package/cjs/picker/constants.d.ts +0 -2
  79. package/cjs/picker/constants.js +2 -3
  80. package/cjs/picker/constants.js.map +1 -1
  81. package/cjs/picker/pick-interceptor.d.ts +2 -7
  82. package/cjs/picker/pick-interceptor.js +2 -19
  83. package/cjs/picker/pick-interceptor.js.map +1 -1
  84. package/cjs/picker/pick-modules.js +4 -7
  85. package/cjs/picker/pick-modules.js.map +1 -1
  86. package/cjs/picker/picker-service.d.ts +2 -4
  87. package/cjs/picker/picker-service.js +12 -13
  88. package/cjs/picker/picker-service.js.map +1 -1
  89. package/cjs/plugins/builtin-plugin/edit-module.d.ts +5 -6
  90. package/cjs/plugins/builtin-plugin/edit-module.js +28 -84
  91. package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -1
  92. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +30 -49
  93. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +217 -280
  94. package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  95. package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
  96. package/cjs/render/contributions/render/base-render.d.ts +0 -1
  97. package/cjs/render/contributions/render/base-render.js +2 -20
  98. package/cjs/render/contributions/render/base-render.js.map +1 -1
  99. package/cjs/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  100. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +2 -29
  101. package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  102. package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +2 -6
  103. package/cjs/render/contributions/render/contributions/image-contribution-render.js +3 -48
  104. package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  105. package/cjs/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -8
  106. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -30
  107. package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  108. package/cjs/render/contributions/render/image-render.js +12 -12
  109. package/cjs/render/contributions/render/image-render.js.map +1 -1
  110. package/cjs/render/contributions/render/path-render.js.map +1 -1
  111. package/cjs/render/contributions/render/polygon-render.js.map +1 -1
  112. package/cjs/render/contributions/render/symbol-render.js +12 -15
  113. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  114. package/cjs/render/contributions/render/utils.d.ts +2 -1
  115. package/cjs/render/contributions/render/utils.js +20 -4
  116. package/cjs/render/contributions/render/utils.js.map +1 -1
  117. package/dist/index.es.js +7566 -8256
  118. package/es/animate/Ticker/default-ticker.d.ts +0 -2
  119. package/es/animate/Ticker/default-ticker.js +1 -7
  120. package/es/animate/Ticker/default-ticker.js.map +1 -1
  121. package/es/animate/animate.js +1 -1
  122. package/es/animate/animate.js.map +1 -1
  123. package/es/animate/easing.d.ts +0 -4
  124. package/es/animate/easing.js +1 -12
  125. package/es/animate/easing.js.map +1 -1
  126. package/es/animate/index.d.ts +0 -1
  127. package/es/animate/index.js +0 -2
  128. package/es/animate/index.js.map +1 -1
  129. package/es/color-string/store.js +2 -1
  130. package/es/common/3d-interceptor.js +1 -2
  131. package/es/common/bezier-utils.d.ts +0 -3
  132. package/es/common/bezier-utils.js +0 -14
  133. package/es/common/bezier-utils.js.map +1 -1
  134. package/es/common/custom-path2d.d.ts +0 -4
  135. package/es/common/custom-path2d.js +12 -44
  136. package/es/common/custom-path2d.js.map +1 -1
  137. package/es/common/render-area.js +2 -1
  138. package/es/common/render-command-list.js +1 -2
  139. package/es/common/segment/curve/arc.d.ts +1 -4
  140. package/es/common/segment/curve/arc.js +1 -10
  141. package/es/common/segment/curve/arc.js.map +1 -1
  142. package/es/common/segment/curve/base.d.ts +1 -4
  143. package/es/common/segment/curve/base.js.map +1 -1
  144. package/es/common/segment/curve/cubic-bezier.d.ts +1 -5
  145. package/es/common/segment/curve/cubic-bezier.js +1 -22
  146. package/es/common/segment/curve/cubic-bezier.js.map +1 -1
  147. package/es/common/segment/curve/curve-context.js +3 -6
  148. package/es/common/segment/curve/curve-context.js.map +1 -1
  149. package/es/common/segment/curve/ellipse.d.ts +1 -4
  150. package/es/common/segment/curve/ellipse.js +0 -9
  151. package/es/common/segment/curve/ellipse.js.map +1 -1
  152. package/es/common/segment/curve/line.d.ts +1 -4
  153. package/es/common/segment/curve/line.js +0 -18
  154. package/es/common/segment/curve/line.js.map +1 -1
  155. package/es/common/segment/curve/move.d.ts +1 -4
  156. package/es/common/segment/curve/move.js +0 -9
  157. package/es/common/segment/curve/move.js.map +1 -1
  158. package/es/common/segment/curve/path.d.ts +1 -2
  159. package/es/common/segment/curve/path.js +2 -5
  160. package/es/common/segment/curve/path.js.map +1 -1
  161. package/es/common/segment/curve/quadratic-bezier.d.ts +2 -6
  162. package/es/common/segment/curve/quadratic-bezier.js +5 -28
  163. package/es/common/segment/curve/quadratic-bezier.js.map +1 -1
  164. package/es/common/store.js +1 -1
  165. package/es/graphic/builtin-symbol/rect.d.ts +1 -2
  166. package/es/graphic/builtin-symbol/rect.js +0 -28
  167. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  168. package/es/graphic/builtin-symbol/utils.d.ts +1 -2
  169. package/es/graphic/builtin-symbol/utils.js +0 -5
  170. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  171. package/es/graphic/config.js +1 -6
  172. package/es/graphic/config.js.map +1 -1
  173. package/es/graphic/graphic.js +1 -2
  174. package/es/graphic/graphic.js.map +1 -1
  175. package/es/graphic/richtext/wrapper.d.ts +0 -1
  176. package/es/graphic/richtext/wrapper.js +1 -1
  177. package/es/graphic/richtext/wrapper.js.map +1 -1
  178. package/es/graphic/richtext.js +1 -2
  179. package/es/graphic/richtext.js.map +1 -1
  180. package/es/index.d.ts +0 -1
  181. package/es/index.js +0 -2
  182. package/es/index.js.map +1 -1
  183. package/es/interface/animate.d.ts +39 -5
  184. package/es/interface/animate.js.map +1 -1
  185. package/es/interface/graphic/path.d.ts +0 -1
  186. package/es/interface/graphic/path.js.map +1 -1
  187. package/es/interface/graphic/symbol.d.ts +0 -2
  188. package/es/interface/graphic/symbol.js.map +1 -1
  189. package/es/interface/graphic.d.ts +2 -6
  190. package/es/interface/graphic.js.map +1 -1
  191. package/es/interface/path.d.ts +0 -5
  192. package/es/interface/path.js.map +1 -1
  193. package/es/interface/picker.d.ts +0 -13
  194. package/es/interface/picker.js.map +1 -1
  195. package/es/picker/constants.d.ts +0 -2
  196. package/es/picker/constants.js +0 -4
  197. package/es/picker/constants.js.map +1 -1
  198. package/es/picker/pick-interceptor.d.ts +2 -7
  199. package/es/picker/pick-interceptor.js +1 -19
  200. package/es/picker/pick-interceptor.js.map +1 -1
  201. package/es/picker/pick-modules.js +3 -5
  202. package/es/picker/pick-modules.js.map +1 -1
  203. package/es/picker/picker-service.d.ts +2 -4
  204. package/es/picker/picker-service.js +13 -13
  205. package/es/picker/picker-service.js.map +1 -1
  206. package/es/plugins/builtin-plugin/edit-module.d.ts +5 -6
  207. package/es/plugins/builtin-plugin/edit-module.js +25 -79
  208. package/es/plugins/builtin-plugin/edit-module.js.map +1 -1
  209. package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +30 -49
  210. package/es/plugins/builtin-plugin/richtext-edit-plugin.js +214 -283
  211. package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -1
  212. package/es/render/contributions/render/arc3d-render.js.map +1 -1
  213. package/es/render/contributions/render/base-render.d.ts +0 -1
  214. package/es/render/contributions/render/base-render.js +2 -21
  215. package/es/render/contributions/render/base-render.js.map +1 -1
  216. package/es/render/contributions/render/contributions/base-contribution-render.js.map +1 -1
  217. package/es/render/contributions/render/contributions/base-texture-contribution-render.js +2 -29
  218. package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
  219. package/es/render/contributions/render/contributions/image-contribution-render.d.ts +2 -6
  220. package/es/render/contributions/render/contributions/image-contribution-render.js +2 -52
  221. package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
  222. package/es/render/contributions/render/contributions/symbol-contribution-render.d.ts +1 -8
  223. package/es/render/contributions/render/contributions/symbol-contribution-render.js +0 -26
  224. package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
  225. package/es/render/contributions/render/image-render.js +12 -12
  226. package/es/render/contributions/render/image-render.js.map +1 -1
  227. package/es/render/contributions/render/path-render.js.map +1 -1
  228. package/es/render/contributions/render/polygon-render.js.map +1 -1
  229. package/es/render/contributions/render/symbol-render.js +13 -16
  230. package/es/render/contributions/render/symbol-render.js.map +1 -1
  231. package/es/render/contributions/render/utils.d.ts +2 -1
  232. package/es/render/contributions/render/utils.js +18 -0
  233. package/es/render/contributions/render/utils.js.map +1 -1
  234. package/package.json +1 -1
  235. package/cjs/animate/easing-func.d.ts +0 -1
  236. package/cjs/animate/easing-func.js +0 -16
  237. package/cjs/animate/easing-func.js.map +0 -1
  238. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +0 -1
  239. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js +0 -3
  240. package/cjs/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +0 -1
  241. package/es/animate/easing-func.d.ts +0 -1
  242. package/es/animate/easing-func.js +0 -10
  243. package/es/animate/easing-func.js.map +0 -1
  244. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.d.ts +0 -1
  245. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js +0 -3
  246. package/es/plugins/builtin-plugin/richtext-edit-plugin-old.js.map +0 -1
@@ -4,40 +4,35 @@ import { Generator } from "../../common/generator";
4
4
 
5
5
  import { createGroup, createLine, createRect } from "../../graphic";
6
6
 
7
- import { DefaultTicker, DefaultTimeline } from "../../animate";
8
-
9
- import { EditModule } from "./edit-module";
10
-
11
- import { application } from "../../application";
7
+ import { EditModule, findCursorIndexIgnoreLinebreak } from "./edit-module";
12
8
 
13
9
  class Selection {
14
- constructor(selectionStartCursorIdx, curCursorIdx, rt) {
10
+ constructor(cacheSelectionStartCursorIdx, cacheCurCursorIdx, selectionStartCursorIdx, curCursorIdx, rt) {
15
11
  this.curCursorIdx = curCursorIdx, this.selectionStartCursorIdx = selectionStartCursorIdx,
12
+ this.cacheCurCursorIdx = cacheCurCursorIdx, this.cacheSelectionStartCursorIdx = cacheSelectionStartCursorIdx,
16
13
  this.rt = rt;
17
14
  }
18
- isEmpty() {
19
- return this.selectionStartCursorIdx === this.curCursorIdx;
20
- }
21
15
  hasFormat(key) {
22
16
  return null != this.getFormat(key);
23
17
  }
24
- _getFormat(key, cursorIdx) {
25
- var _a;
26
- if (!this.rt) return null;
27
- const idx = Math.round(cursorIdx), config = this.rt.attribute.textConfig;
28
- return null !== (_a = config[Math.min(idx, config.length - 1)][key]) && void 0 !== _a ? _a : this.rt.attribute[key];
29
- }
30
18
  getFormat(key) {
31
- return this.getAllFormat(key)[0];
19
+ if (!this.rt) return null;
20
+ const config = this.rt.attribute.textConfig, val = config[this.selectionStartCursorIdx + 1][key];
21
+ if (null == val) return null;
22
+ for (let i = this.selectionStartCursorIdx + 2; i <= this.curCursorIdx; i++) {
23
+ if (val !== config[i][key]) return null;
24
+ }
25
+ return val;
32
26
  }
33
27
  getAllFormat(key) {
34
- const valSet = new Set, minCursorIdx = Math.min(this.selectionStartCursorIdx, this.curCursorIdx), maxCursorIdx = Math.max(this.selectionStartCursorIdx, this.curCursorIdx);
35
- if (minCursorIdx === maxCursorIdx) return [ this._getFormat(key, minCursorIdx) ];
36
- for (let i = minCursorIdx; i < maxCursorIdx; i++) {
37
- const val = this._getFormat(key, i);
38
- val && valSet.add(val);
28
+ if (!this.rt) return [];
29
+ const config = this.rt.attribute.textConfig, val = config[this.selectionStartCursorIdx + 1][key], set = new Set;
30
+ set.add(val);
31
+ for (let i = this.selectionStartCursorIdx + 2; i <= this.curCursorIdx; i++) {
32
+ const item = config[i];
33
+ set.add(item[key]);
39
34
  }
40
- return Array.from(valSet.values());
35
+ return Array.from(set.values());
41
36
  }
42
37
  }
43
38
 
@@ -46,88 +41,39 @@ export const FORMAT_TEXT_COMMAND = "FORMAT_TEXT_COMMAND";
46
41
  export const FORMAT_ELEMENT_COMMAND = "FORMAT_ELEMENT_COMMAND";
47
42
 
48
43
  export class RichTextEditPlugin {
49
- static splitText(text) {
50
- return Array.from(text);
51
- }
52
- static tryUpdateRichtext(richtext) {
53
- if (!richtext.getFrameCache().lines.every((line => line.paragraphs.every((item => !(item.text && isString(item.text) && RichTextEditPlugin.splitText(item.text).length > 1)))))) {
54
- const tc = [];
55
- richtext.attribute.textConfig.forEach((item => {
56
- const textList = RichTextEditPlugin.splitText(item.text.toString());
57
- if (isString(item.text) && textList.length > 1) for (let i = 0; i < textList.length; i++) {
58
- const t = textList[i];
59
- tc.push(Object.assign(Object.assign({}, item), {
60
- text: t
61
- }));
62
- } else tc.push(item);
63
- })), richtext.setAttributes({
64
- textConfig: tc
65
- }), richtext.doUpdateFrameCache(tc);
66
- }
67
- }
68
- static CreateSelection(rt) {
69
- if (!rt) return null;
70
- const {textConfig: textConfig = []} = rt.attribute;
71
- return new Selection(0, textConfig.length - 1, rt);
72
- }
73
44
  constructor() {
74
45
  this.name = "RichTextEditPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(),
75
- this.key = this.name + this._uid, this.editing = !1, this.pointerDown = !1, this.handleKeyDown = e => {
76
- if (!this.currRt || !this.editing) return;
77
- const cache = this.currRt.getFrameCache();
78
- if (!cache) return;
79
- let x = 0, y = 0;
80
- "ArrowUp" === e.key ? y = -1 : "ArrowDown" === e.key ? y = 1 : "ArrowLeft" === e.key ? x = -1 : "ArrowRight" === e.key && (x = 1);
81
- const {lineInfo: lineInfo, columnInfo: columnInfo} = this.getColumnByIndex(cache, Math.round(this.curCursorIdx));
82
- if (x) {
83
- x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 2] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + .2 : x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 1] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + 1 - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - 1 + .2 : this.curCursorIdx += x;
84
- const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
85
- this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt), this.hideSelection();
86
- }
87
- if (y) {
88
- if (y > 0 && lineInfo === cache.lines[cache.lines.length - 1]) return;
89
- if (y < 0 && lineInfo === cache.lines[0]) return;
90
- const lineIdx = cache.lines.findIndex((item => item === lineInfo)) + y;
91
- if (lineIdx < 0 || lineIdx >= cache.lines.length) return;
92
- const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt), posX = pos.x;
93
- let posY = (pos.y1 + pos.y2) / 2;
94
- posY += y * lineInfo.height;
95
- const nextLineInfo = cache.lines[lineIdx], {columnInfo: columnInfo, delta: delta} = this.getColumnAndIndexByLinePoint(nextLineInfo, {
96
- x: posX,
97
- y: posY
98
- });
99
- if (!columnInfo) return;
100
- const cursorIdx = this.getColumnIndex(cache, columnInfo) + delta, data = this.computedCursorPosByCursorIdx(cursorIdx, this.currRt);
101
- this.curCursorIdx = cursorIdx, this.selectionStartCursorIdx = cursorIdx, this.setCursorAndTextArea(data.x, data.y1, data.y2, this.currRt);
102
- }
103
- }, this.handleInput = (text, isComposing, cursorIdx, rt) => {
104
- this.hideSelection(), this.updateCbs.forEach((cb => cb("input", this)));
105
- }, this.handleChange = (text, isComposing, cursorIdx, rt) => {
106
- this.curCursorIdx = cursorIdx, this.selectionStartCursorIdx = cursorIdx;
107
- const p = this.computedCursorPosByCursorIdx(cursorIdx, rt);
108
- this.setCursorAndTextArea(p.x, p.y1, p.y2, rt), this.hideSelection(), this.updateCbs.forEach((cb => cb("change", this)));
46
+ this.key = this.name + this._uid, this.editing = !1, this.pointerDown = !1, this.handleInput = (text, isComposing, cursorIdx, rt, orient) => {
47
+ const p = this.getPointByColumnIdx(cursorIdx, rt, orient);
48
+ this.hideSelection(), this.setCursor(p.x, p.y1, p.y2), this.updateCbs.forEach((cb => cb("input", this)));
49
+ }, this.handleChange = (text, isComposing, cursorIdx, rt, orient) => {
50
+ const p = this.getPointByColumnIdx(cursorIdx, rt, orient);
51
+ this.curCursorIdx = cursorIdx, this.selectionStartCursorIdx = cursorIdx, this.setCursorAndTextArea(p.x, p.y1, p.y2, rt),
52
+ this.hideSelection(), this.updateCbs.forEach((cb => cb("change", this)));
109
53
  }, this.handleMove = e => {
110
54
  this.isRichtext(e) && (this.currRt = e.target, this.handleEnter(e), e.target.once("pointerleave", this.handleLeave),
111
- this.tryShowSelection(e));
112
- }, this.handleEnter = e => {
113
- this.editing = !0, this.pluginService.stage.setCursor("text");
114
- }, this.handleLeave = e => {
115
- this.editing = !1, this.pluginService.stage.setCursor("default");
55
+ this.showSelection(e));
116
56
  }, this.handlePointerDown = e => {
117
- this.editing ? this.onFocus(e) : this.deFocus(e), this.triggerRender(), this.pointerDown = !0,
57
+ this.editing ? this.onFocus(e) : this.deFocus(e), this.applyUpdate(), this.pointerDown = !0,
118
58
  this.updateCbs.forEach((cb => cb(this.editing ? "onfocus" : "defocus", this)));
119
59
  }, this.handlePointerUp = e => {
120
60
  this.pointerDown = !1;
61
+ }, this.handleEnter = e => {
62
+ this.editing = !0, this.pluginService.stage.setCursor("text");
63
+ }, this.handleLeave = e => {
64
+ this.editing = !1, this.pluginService.stage.setCursor("default");
121
65
  }, this.commandCbs = new Map, this.commandCbs.set(FORMAT_TEXT_COMMAND, [ this.formatTextCommandCb ]),
122
- this.updateCbs = [], this.timeline = new DefaultTimeline, this.ticker = new DefaultTicker([ this.timeline ]),
123
- this.deltaX = 0, this.deltaY = 0;
66
+ this.updateCbs = [];
67
+ }
68
+ getSelection() {
69
+ return this.selectionStartCursorIdx && this.curCursorIdx && this.selectionStartCursorIdx !== this.curCursorIdx && this.currRt ? new Selection(this.selectionStartCursorIdx, this.curCursorIdx, findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.selectionStartCursorIdx), findCursorIndexIgnoreLinebreak(this.currRt.attribute.textConfig, this.curCursorIdx), this.currRt) : null;
124
70
  }
125
71
  formatTextCommandCb(payload, p) {
126
72
  const rt = p.currRt;
127
73
  if (!rt) return;
128
74
  const selectionData = p.getSelection();
129
75
  if (!selectionData) return;
130
- const {selectionStartCursorIdx: selectionStartCursorIdx, curCursorIdx: curCursorIdx} = selectionData, minCursorIdx = Math.min(selectionStartCursorIdx, curCursorIdx), maxCursorIdx = Math.max(selectionStartCursorIdx, curCursorIdx), config = rt.attribute.textConfig.slice(minCursorIdx + 1, maxCursorIdx + 1);
76
+ const {selectionStartCursorIdx: selectionStartCursorIdx, curCursorIdx: curCursorIdx} = selectionData, config = rt.attribute.textConfig.slice(selectionStartCursorIdx + 1, curCursorIdx + 1);
131
77
  "bold" === payload ? config.forEach((item => item.fontWeight = "bold")) : "italic" === payload ? config.forEach((item => item.fontStyle = "italic")) : "underline" === payload ? config.forEach((item => item.underline = !0)) : "lineThrough" === payload ? config.forEach((item => item.lineThrough = !0)) : isObject(payload) && config.forEach((item => merge(item, payload))),
132
78
  rt.setAttributes(rt.attribute);
133
79
  }
@@ -144,32 +90,125 @@ export class RichTextEditPlugin {
144
90
  activate(context) {
145
91
  this.pluginService = context, this.editModule = new EditModule, context.stage.on("pointermove", this.handleMove),
146
92
  context.stage.on("pointerdown", this.handlePointerDown), context.stage.on("pointerup", this.handlePointerUp),
147
- context.stage.on("pointerleave", this.handlePointerUp), application.global.addEventListener("keydown", this.handleKeyDown),
148
- this.editModule.onInput(this.handleInput), this.editModule.onChange(this.handleChange);
93
+ context.stage.on("pointerleave", this.handlePointerUp), this.editModule.onInput(this.handleInput),
94
+ this.editModule.onChange(this.handleChange);
149
95
  }
150
- deactivate(context) {
151
- context.stage.off("pointermove", this.handleMove), context.stage.off("pointerdown", this.handlePointerDown),
152
- context.stage.off("pointerup", this.handlePointerUp), context.stage.off("pointerleave", this.handlePointerUp),
153
- application.global.addEventListener("keydown", this.handleKeyDown);
96
+ showSelection(e) {
97
+ const cache = e.target.getFrameCache();
98
+ if (cache && this.editBg && this.pointerDown) {
99
+ let p0 = this.lastPoint, p1 = this.getEventPosition(e), line1Info = this.getLineByPoint(cache, p1);
100
+ const column1 = this.getColumnByLinePoint(line1Info, p1), y1 = line1Info.top, y2 = line1Info.top + line1Info.height;
101
+ let x = column1.left + column1.width, cursorIndex = this.getColumnIndex(cache, column1);
102
+ p1.x < column1.left + column1.width / 2 && (x = column1.left, cursorIndex -= 1),
103
+ p1.x = x, p1.y = (y1 + y2) / 2;
104
+ let line0Info = this.getLineByPoint(cache, p0);
105
+ if ((p0.y > p1.y || p0.y === p1.y && p0.x > p1.x) && ([p0, p1] = [ p1, p0 ], [line1Info, line0Info] = [ line0Info, line1Info ]),
106
+ this.editBg.removeAllChild(), line0Info === line1Info) {
107
+ const column0 = this.getColumnByLinePoint(line0Info, p0);
108
+ this.editBg.setAttributes({
109
+ x: p0.x,
110
+ y: line0Info.top,
111
+ width: p1.x - p0.x,
112
+ height: column0.height,
113
+ fill: "#336df4",
114
+ fillOpacity: .2
115
+ });
116
+ } else {
117
+ this.editBg.setAttributes({
118
+ x: 0,
119
+ y: line0Info.top,
120
+ width: 0,
121
+ height: 0
122
+ });
123
+ const startIdx = cache.lines.findIndex((item => item === line0Info)), endIdx = cache.lines.findIndex((item => item === line1Info));
124
+ let y = 0;
125
+ for (let i = startIdx; i <= endIdx; i++) {
126
+ const line = cache.lines[i];
127
+ if (i === startIdx) {
128
+ const p = line.paragraphs[line.paragraphs.length - 1];
129
+ this.editBg.add(createRect({
130
+ x: p0.x,
131
+ y: y,
132
+ width: p.left + p.width - p0.x,
133
+ height: line.height,
134
+ fill: "#336df4",
135
+ fillOpacity: .2
136
+ }));
137
+ } else if (i === endIdx) {
138
+ const p = line.paragraphs[0];
139
+ this.editBg.add(createRect({
140
+ x: p.left,
141
+ y: y,
142
+ width: p1.x - p.left,
143
+ height: line.height,
144
+ fill: "#336df4",
145
+ fillOpacity: .2
146
+ }));
147
+ } else {
148
+ const p0 = line.paragraphs[0], p1 = line.paragraphs[line.paragraphs.length - 1];
149
+ this.editBg.add(createRect({
150
+ x: p0.left,
151
+ y: y,
152
+ width: p1.left + p1.width - p0.left,
153
+ height: line.height,
154
+ fill: "#336df4",
155
+ fillOpacity: .2
156
+ }));
157
+ }
158
+ y += line.height;
159
+ }
160
+ }
161
+ this.curCursorIdx = cursorIndex, this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target),
162
+ this.applyUpdate(), this.updateCbs.forEach((cb => cb("selection", this)));
163
+ }
164
+ }
165
+ hideSelection() {
166
+ this.editBg && (this.editBg.removeAllChild(), this.editBg.setAttributes({
167
+ fill: "transparent"
168
+ }));
169
+ }
170
+ isRichtext(e) {
171
+ return !(!e.target || "richtext" !== e.target.type || !e.target.attribute.editable);
172
+ }
173
+ getEventPosition(e) {
174
+ const p = this.pluginService.stage.eventPointTransform(e), p1 = {
175
+ x: 0,
176
+ y: 0
177
+ };
178
+ return e.target.globalTransMatrix.transformPoint(p, p1), p1;
179
+ }
180
+ getLineByPoint(cache, p1) {
181
+ let lineInfo = cache.lines[0];
182
+ for (let i = 0; i < cache.lines.length && !(lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y); i++) lineInfo = cache.lines[i + 1];
183
+ return lineInfo;
184
+ }
185
+ getColumnByLinePoint(lineInfo, p1) {
186
+ let columnInfo = lineInfo.paragraphs[0];
187
+ for (let i = 0; i < lineInfo.paragraphs.length && !(columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x); i++) columnInfo = lineInfo.paragraphs[i];
188
+ return columnInfo;
154
189
  }
155
190
  onFocus(e) {
156
- this.deFocus(e), this.currRt = e.target;
191
+ this.deFocus(e);
157
192
  const target = e.target;
158
- RichTextEditPlugin.tryUpdateRichtext(target);
159
- const shadowRoot = target.attachShadow(), cache = target.getFrameCache();
193
+ this.tryUpdateRichtext(target);
194
+ const shadowRoot = target.attachShadow();
195
+ shadowRoot.setAttributes({
196
+ shadowRootIdx: -1
197
+ });
198
+ const cache = target.getFrameCache();
160
199
  if (!cache) return;
161
- if (this.computeGlobalDelta(cache), shadowRoot.setAttributes({
162
- shadowRootIdx: -1,
163
- x: this.deltaX,
164
- y: this.deltaY
165
- }), !this.editLine) {
200
+ if (!this.editLine) {
166
201
  const line = createLine({
167
202
  x: 0,
168
203
  y: 0,
169
204
  lineWidth: 1,
170
205
  stroke: "black"
171
206
  });
172
- this.addAnimateToLine(line), this.editLine = line, this.ticker.start(!0);
207
+ line.animate().to({
208
+ opacity: 1
209
+ }, 10, "linear").wait(700).to({
210
+ opacity: 0
211
+ }, 10, "linear").wait(700).loop(1 / 0), this.editLine = line;
173
212
  const g = createGroup({
174
213
  x: 0,
175
214
  y: 0,
@@ -178,125 +217,28 @@ export class RichTextEditPlugin {
178
217
  });
179
218
  this.editBg = g, shadowRoot.add(this.editLine), shadowRoot.add(this.editBg);
180
219
  }
181
- const data = this.computedCursorPosByEvent(e, cache);
182
- if (data) {
183
- const {x: x, y1: y1, y2: y2, cursorIndex: cursorIndex} = data;
184
- this.startCursorPos = {
220
+ const p1 = this.getEventPosition(e), lineInfo = this.getLineByPoint(cache, p1);
221
+ if (lineInfo) {
222
+ const columnInfo = this.getColumnByLinePoint(lineInfo, p1);
223
+ if (!columnInfo) return;
224
+ let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height, x = columnInfo.left + columnInfo.width;
225
+ y1 += 2, y2 -= 2;
226
+ let cursorIndex = this.getColumnIndex(cache, columnInfo);
227
+ p1.x < columnInfo.left + columnInfo.width / 2 && (x = columnInfo.left, cursorIndex -= 1),
228
+ this.lastPoint = {
185
229
  x: x,
186
230
  y: (y1 + y2) / 2
187
231
  }, this.curCursorIdx = cursorIndex, this.selectionStartCursorIdx = cursorIndex,
188
232
  this.setCursorAndTextArea(x, y1, y2, target);
189
233
  }
190
234
  }
191
- deFocus(e) {
192
- const target = this.currRt;
193
- target && (target.detachShadow(), this.currRt = null, this.editLine && (this.editLine.parent.removeChild(this.editLine),
194
- this.editLine.release(), this.editLine = null, this.editBg.parent.removeChild(this.editBg),
195
- this.editBg.release(), this.editBg = null));
196
- }
197
- addAnimateToLine(line) {
198
- line.animates && line.animates.forEach((animate => {
199
- animate.stop(), animate.release();
200
- }));
201
- const animate = line.animate();
202
- animate.setTimeline(this.timeline), animate.to({
203
- opacity: 1
204
- }, 10, "linear").wait(700).to({
205
- opacity: 0
206
- }, 10, "linear").wait(700).loop(1 / 0);
207
- }
208
- tryShowSelection(e) {
209
- const cache = e.target.getFrameCache();
210
- if (!(cache && this.editBg && this.pointerDown && this.startCursorPos)) return;
211
- let startCursorPos = this.startCursorPos;
212
- const currCursorData = this.computedCursorPosByEvent(e, cache);
213
- if (!currCursorData) return;
214
- this.curCursorIdx = currCursorData.cursorIndex;
215
- let endCursorPos = {
216
- x: currCursorData.x,
217
- y: (currCursorData.y1 + currCursorData.y2) / 2
218
- }, line0Info = this.getLineByPoint(cache, startCursorPos), line1Info = this.getLineByPoint(cache, endCursorPos);
219
- if ((startCursorPos.y > endCursorPos.y || startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x) && ([startCursorPos, endCursorPos] = [ endCursorPos, startCursorPos ],
220
- [line1Info, line0Info] = [ line0Info, line1Info ]), this.hideSelection(), line0Info === line1Info) this.editBg.setAttributes({
221
- x: startCursorPos.x,
222
- y: line0Info.top,
223
- width: endCursorPos.x - startCursorPos.x,
224
- height: line0Info.height,
225
- fill: "#336df4",
226
- fillOpacity: .2
227
- }); else {
228
- this.editBg.setAttributes({
229
- x: 0,
230
- y: line0Info.top,
231
- width: 0,
232
- height: 0
233
- });
234
- const startIdx = cache.lines.findIndex((item => item === line0Info)), endIdx = cache.lines.findIndex((item => item === line1Info));
235
- let y = 0;
236
- for (let i = startIdx; i <= endIdx; i++) {
237
- const line = cache.lines[i];
238
- if (i === startIdx) {
239
- const p = line.paragraphs[line.paragraphs.length - 1];
240
- this.editBg.add(createRect({
241
- x: startCursorPos.x,
242
- y: y,
243
- width: p.left + p.width - startCursorPos.x,
244
- height: line.height,
245
- fill: "#336df4",
246
- fillOpacity: .2
247
- }));
248
- } else if (i === endIdx) {
249
- const p = line.paragraphs[0];
250
- this.editBg.add(createRect({
251
- x: p.left,
252
- y: y,
253
- width: endCursorPos.x - p.left,
254
- height: line.height,
255
- fill: "#336df4",
256
- fillOpacity: .2
257
- }));
258
- } else {
259
- const p0 = line.paragraphs[0], p1 = line.paragraphs[line.paragraphs.length - 1];
260
- this.editBg.add(createRect({
261
- x: p0.left,
262
- y: y,
263
- width: p1.left + p1.width - p0.left,
264
- height: line.height,
265
- fill: "#336df4",
266
- fillOpacity: .2
267
- }));
268
- }
269
- y += line.height;
270
- }
271
- }
272
- this.setCursorAndTextArea(currCursorData.x, currCursorData.y1 + 2, currCursorData.y2 - 2, e.target),
273
- this.triggerRender(), this.updateCbs.forEach((cb => cb("selection", this)));
274
- }
275
- hideSelection() {
276
- this.editBg && (this.editBg.removeAllChild(), this.editBg.setAttributes({
277
- fill: "transparent"
278
- }));
279
- }
280
- getLineByPoint(cache, p1) {
281
- let lineInfo = cache.lines[0];
282
- for (let i = 0; i < cache.lines.length && !(lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y); i++) lineInfo = cache.lines[i + 1];
283
- return lineInfo;
284
- }
285
- getColumnAndIndexByLinePoint(lineInfo, p1) {
286
- let columnInfo = lineInfo.paragraphs[0], delta = 0;
287
- if (lineInfo.paragraphs.length) {
288
- const start = lineInfo.paragraphs[0], end = lineInfo.paragraphs[lineInfo.paragraphs.length - 1];
289
- p1.x <= start.left ? (delta = -.1, columnInfo = start) : p1.x >= end.left + end.width && (delta = .1,
290
- columnInfo = end);
291
- }
292
- if (!delta) for (let i = 0; i < lineInfo.paragraphs.length; i++) if (columnInfo = lineInfo.paragraphs[i],
293
- columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {
294
- delta = p1.x > columnInfo.left + columnInfo.width / 2 ? .1 : -.1;
295
- break;
296
- }
297
- return {
298
- columnInfo: columnInfo,
299
- delta: delta
235
+ getPointByColumnIdx(idx, rt, orient) {
236
+ const cache = rt.getFrameCache(), {lineInfo: lineInfo, columnInfo: columnInfo} = this.getColumnByIndex(cache, idx);
237
+ let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height;
238
+ return y1 += 2, y2 -= 2, {
239
+ x: columnInfo.left + ("left" === orient ? 0 : columnInfo.width),
240
+ y1: y1,
241
+ y2: y2
300
242
  };
301
243
  }
302
244
  getColumnIndex(cache, cInfo) {
@@ -307,25 +249,19 @@ export class RichTextEditPlugin {
307
249
  }
308
250
  return -1;
309
251
  }
310
- isRichtext(e) {
311
- return !(!e.target || "richtext" !== e.target.type || !e.target.attribute.editable);
312
- }
313
- triggerRender() {
314
- this.pluginService.stage.renderNextFrame();
315
- }
316
- computeGlobalDelta(cache) {
317
- this.deltaX = 0, this.deltaY = 0;
318
- const height = cache.height, actualHeight = cache.actualHeight, width = cache.lines.reduce(((w, item) => Math.max(w, item.actualWidth)), 0);
319
- "center" === cache.globalAlign ? this.deltaX = -width / 2 : "right" === cache.globalAlign && (this.deltaX = -width),
320
- "middle" === cache.verticalDirection ? this.deltaY = height / 2 - actualHeight / 2 : "bottom" === cache.verticalDirection && (this.deltaY = height - actualHeight);
321
- }
322
- getEventPosition(e) {
323
- const p = this.pluginService.stage.eventPointTransform(e), p1 = {
324
- x: 0,
325
- y: 0
326
- };
327
- return e.target.globalTransMatrix.transformPoint(p, p1), p1.x -= this.deltaX, p1.y -= this.deltaY,
328
- p1;
252
+ getColumnByIndex(cache, index) {
253
+ let inputIndex = -1;
254
+ for (let i = 0; i < cache.lines.length; i++) {
255
+ const lineInfo = cache.lines[i];
256
+ for (let j = 0; j < lineInfo.paragraphs.length; j++) {
257
+ const columnInfo = lineInfo.paragraphs[j];
258
+ if (inputIndex++, inputIndex === index) return {
259
+ lineInfo: lineInfo,
260
+ columnInfo: columnInfo
261
+ };
262
+ }
263
+ }
264
+ return null;
329
265
  }
330
266
  setCursorAndTextArea(x, y1, y2, rt) {
331
267
  this.editLine.setAttributes({
@@ -336,7 +272,7 @@ export class RichTextEditPlugin {
336
272
  x: x,
337
273
  y: y2
338
274
  } ]
339
- }), this.addAnimateToLine(this.editLine);
275
+ });
340
276
  const out = {
341
277
  x: 0,
342
278
  y: 0
@@ -348,57 +284,52 @@ export class RichTextEditPlugin {
348
284
  const {left: left, top: top} = this.pluginService.stage.window.getBoundingClientRect();
349
285
  out.x += left, out.y += top, this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
350
286
  }
351
- computedCursorPosByEvent(e, cache) {
352
- const p1 = this.getEventPosition(e), lineInfo = this.getLineByPoint(cache, p1);
353
- if (!lineInfo) return;
354
- const {columnInfo: columnInfo, delta: delta} = this.getColumnAndIndexByLinePoint(lineInfo, p1);
355
- if (!columnInfo) return;
356
- let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height;
357
- y1 += 2, y2 -= 2;
358
- let cursorIndex = this.getColumnIndex(cache, columnInfo);
359
- cursorIndex += delta;
360
- return {
361
- x: columnInfo.left + (delta > 0 ? columnInfo.width : 0),
362
- y1: y1,
363
- y2: y2,
364
- cursorIndex: cursorIndex
365
- };
287
+ setCursor(x, y1, y2) {
288
+ this.editLine.setAttributes({
289
+ points: [ {
290
+ x: x,
291
+ y: y1
292
+ }, {
293
+ x: x,
294
+ y: y2
295
+ } ]
296
+ });
366
297
  }
367
- computedCursorPosByCursorIdx(cursorIdx, rt) {
368
- var _a, _b, _c;
369
- const idx = Math.round(cursorIdx), leftRight = cursorIdx - idx, cache = rt.getFrameCache(), column = this.getColumnByIndex(cache, idx), height = null !== (_a = rt.attribute.fontSize) && void 0 !== _a ? _a : null === (_c = null === (_b = rt.attribute.textConfig) || void 0 === _b ? void 0 : _b[0]) || void 0 === _c ? void 0 : _c.fontSize;
370
- if (!column) return {
371
- x: 0,
372
- y1: 0,
373
- y2: height
374
- };
375
- const {lineInfo: lineInfo, columnInfo: columnInfo} = column;
376
- let y1 = lineInfo.top, y2 = lineInfo.top + lineInfo.height;
377
- return y1 += 2, y2 -= 2, {
378
- x: columnInfo.left + (leftRight < 0 ? 0 : columnInfo.width),
379
- y1: y1,
380
- y2: y2
381
- };
298
+ applyUpdate() {
299
+ this.pluginService.stage.renderNextFrame();
382
300
  }
383
- getColumnByIndex(cache, index) {
384
- for (let i = 0, inputIndex = 0; i < cache.lines.length; i++) {
385
- const lineInfo = cache.lines[i];
386
- for (let j = 0; j < lineInfo.paragraphs.length; j++) {
387
- const columnInfo = lineInfo.paragraphs[j];
388
- if (inputIndex === index) return {
389
- lineInfo: lineInfo,
390
- columnInfo: columnInfo
391
- };
392
- inputIndex++;
393
- }
301
+ deFocus(e) {
302
+ const target = this.currRt;
303
+ target && (target.detachShadow(), this.currRt = null, this.editLine && (this.editLine.parent.removeChild(this.editLine),
304
+ this.editLine.release(), this.editLine = null, this.editBg.parent.removeChild(this.editBg),
305
+ this.editBg.release(), this.editBg = null));
306
+ }
307
+ splitText(text) {
308
+ return Array.from(text);
309
+ }
310
+ tryUpdateRichtext(richtext) {
311
+ if (!richtext.getFrameCache().lines.every((line => line.paragraphs.every((item => !(item.text && isString(item.text) && this.splitText(item.text).length > 1)))))) {
312
+ const tc = [];
313
+ richtext.attribute.textConfig.forEach((item => {
314
+ const textList = this.splitText(item.text.toString());
315
+ if (isString(item.text) && textList.length > 1) for (let i = 0; i < textList.length; i++) {
316
+ const t = textList[i];
317
+ tc.push(Object.assign(Object.assign({}, item), {
318
+ text: t
319
+ }));
320
+ } else tc.push(item);
321
+ })), richtext.setAttributes({
322
+ textConfig: tc
323
+ }), richtext.doUpdateFrameCache(tc);
394
324
  }
395
- return null;
396
325
  }
397
- release() {
398
- this.deactivate(this.pluginService), this.editModule.release();
326
+ onSelect() {}
327
+ deactivate(context) {
328
+ context.stage.off("pointermove", this.handleMove), context.stage.off("pointerdown", this.handlePointerDown),
329
+ context.stage.off("pointerup", this.handlePointerUp), context.stage.off("pointerleave", this.handlePointerUp);
399
330
  }
400
- getSelection(defaultAll = !1) {
401
- return this.currRt ? null != this.selectionStartCursorIdx && null != this.curCursorIdx ? new Selection(this.selectionStartCursorIdx, this.curCursorIdx, this.currRt) : defaultAll ? RichTextEditPlugin.CreateSelection(this.currRt) : null : null;
331
+ release() {
332
+ this.editModule.release();
402
333
  }
403
334
  }
404
335
  //# sourceMappingURL=richtext-edit-plugin.js.map