@hailin-zheng/editor-core 1.0.3 → 1.0.6

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 (303) hide show
  1. package/package.json +6 -2
  2. package/dist/doc-ruler.d.ts +0 -51
  3. package/dist/doc-ruler.js +0 -313
  4. package/dist/doc-ruler.js.map +0 -1
  5. package/dist/framework/common-util.d.ts +0 -63
  6. package/dist/framework/common-util.js +0 -178
  7. package/dist/framework/common-util.js.map +0 -1
  8. package/dist/framework/document-change.d.ts +0 -265
  9. package/dist/framework/document-change.js +0 -1342
  10. package/dist/framework/document-change.js.map +0 -1
  11. package/dist/framework/document-combine.d.ts +0 -24
  12. package/dist/framework/document-combine.js +0 -40
  13. package/dist/framework/document-combine.js.map +0 -1
  14. package/dist/framework/document-comment.d.ts +0 -46
  15. package/dist/framework/document-comment.js +0 -148
  16. package/dist/framework/document-comment.js.map +0 -1
  17. package/dist/framework/document-context.d.ts +0 -149
  18. package/dist/framework/document-context.js +0 -330
  19. package/dist/framework/document-context.js.map +0 -1
  20. package/dist/framework/document-eval-func.d.ts +0 -18
  21. package/dist/framework/document-eval-func.js +0 -48
  22. package/dist/framework/document-eval-func.js.map +0 -1
  23. package/dist/framework/document-event.d.ts +0 -213
  24. package/dist/framework/document-event.js +0 -1054
  25. package/dist/framework/document-event.js.map +0 -1
  26. package/dist/framework/document-history.d.ts +0 -26
  27. package/dist/framework/document-history.js +0 -65
  28. package/dist/framework/document-history.js.map +0 -1
  29. package/dist/framework/document-images-loader.d.ts +0 -16
  30. package/dist/framework/document-images-loader.js +0 -66
  31. package/dist/framework/document-images-loader.js.map +0 -1
  32. package/dist/framework/document-input-cursor.d.ts +0 -78
  33. package/dist/framework/document-input-cursor.js +0 -239
  34. package/dist/framework/document-input-cursor.js.map +0 -1
  35. package/dist/framework/document-paint.d.ts +0 -34
  36. package/dist/framework/document-paint.js +0 -103
  37. package/dist/framework/document-paint.js.map +0 -1
  38. package/dist/framework/document-print-offscreen.d.ts +0 -38
  39. package/dist/framework/document-print-offscreen.js +0 -128
  40. package/dist/framework/document-print-offscreen.js.map +0 -1
  41. package/dist/framework/document-print.d.ts +0 -60
  42. package/dist/framework/document-print.js +0 -203
  43. package/dist/framework/document-print.js.map +0 -1
  44. package/dist/framework/document-segmenter.d.ts +0 -2
  45. package/dist/framework/document-segmenter.js +0 -106
  46. package/dist/framework/document-segmenter.js.map +0 -1
  47. package/dist/framework/document-selection.d.ts +0 -89
  48. package/dist/framework/document-selection.js +0 -358
  49. package/dist/framework/document-selection.js.map +0 -1
  50. package/dist/framework/document-template.d.ts +0 -4
  51. package/dist/framework/document-template.js +0 -20
  52. package/dist/framework/document-template.js.map +0 -1
  53. package/dist/framework/document-textline-mode.d.ts +0 -7
  54. package/dist/framework/document-textline-mode.js +0 -30
  55. package/dist/framework/document-textline-mode.js.map +0 -1
  56. package/dist/framework/element-define.d.ts +0 -319
  57. package/dist/framework/element-define.js +0 -579
  58. package/dist/framework/element-define.js.map +0 -1
  59. package/dist/framework/element-event-define.d.ts +0 -99
  60. package/dist/framework/element-event-define.js +0 -108
  61. package/dist/framework/element-event-define.js.map +0 -1
  62. package/dist/framework/element-measure.d.ts +0 -97
  63. package/dist/framework/element-measure.js +0 -551
  64. package/dist/framework/element-measure.js.map +0 -1
  65. package/dist/framework/element-paint.d.ts +0 -42
  66. package/dist/framework/element-paint.js +0 -170
  67. package/dist/framework/element-paint.js.map +0 -1
  68. package/dist/framework/element-props.d.ts +0 -301
  69. package/dist/framework/element-props.js +0 -809
  70. package/dist/framework/element-props.js.map +0 -1
  71. package/dist/framework/element-reader.d.ts +0 -19
  72. package/dist/framework/element-reader.js +0 -151
  73. package/dist/framework/element-reader.js.map +0 -1
  74. package/dist/framework/element-render-cut.d.ts +0 -55
  75. package/dist/framework/element-render-cut.js +0 -449
  76. package/dist/framework/element-render-cut.js.map +0 -1
  77. package/dist/framework/element-serialize.d.ts +0 -30
  78. package/dist/framework/element-serialize.js +0 -113
  79. package/dist/framework/element-serialize.js.map +0 -1
  80. package/dist/framework/element-util.d.ts +0 -369
  81. package/dist/framework/element-util.js +0 -1463
  82. package/dist/framework/element-util.js.map +0 -1
  83. package/dist/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
  84. package/dist/framework/impl/checkbox/checkbox-impl.js +0 -64
  85. package/dist/framework/impl/checkbox/checkbox-impl.js.map +0 -1
  86. package/dist/framework/impl/comments/comment-content-impl.d.ts +0 -40
  87. package/dist/framework/impl/comments/comment-content-impl.js +0 -105
  88. package/dist/framework/impl/comments/comment-content-impl.js.map +0 -1
  89. package/dist/framework/impl/comments/comment-element-impl.d.ts +0 -21
  90. package/dist/framework/impl/comments/comment-element-impl.js +0 -62
  91. package/dist/framework/impl/comments/comment-element-impl.js.map +0 -1
  92. package/dist/framework/impl/comments/comments-container-impl.d.ts +0 -22
  93. package/dist/framework/impl/comments/comments-container-impl.js +0 -62
  94. package/dist/framework/impl/comments/comments-container-impl.js.map +0 -1
  95. package/dist/framework/impl/comments/comments-util.d.ts +0 -12
  96. package/dist/framework/impl/comments/comments-util.js +0 -67
  97. package/dist/framework/impl/comments/comments-util.js.map +0 -1
  98. package/dist/framework/impl/comments/validate-msg-impl.d.ts +0 -21
  99. package/dist/framework/impl/comments/validate-msg-impl.js +0 -83
  100. package/dist/framework/impl/comments/validate-msg-impl.js.map +0 -1
  101. package/dist/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
  102. package/dist/framework/impl/data-element/data-decorate-impl.js +0 -91
  103. package/dist/framework/impl/data-element/data-decorate-impl.js.map +0 -1
  104. package/dist/framework/impl/data-element/data-element-barcode.d.ts +0 -31
  105. package/dist/framework/impl/data-element/data-element-barcode.js +0 -115
  106. package/dist/framework/impl/data-element/data-element-barcode.js.map +0 -1
  107. package/dist/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
  108. package/dist/framework/impl/data-element/data-element-base-impl.js +0 -205
  109. package/dist/framework/impl/data-element/data-element-base-impl.js.map +0 -1
  110. package/dist/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
  111. package/dist/framework/impl/data-element/data-element-check-impl.js +0 -133
  112. package/dist/framework/impl/data-element/data-element-check-impl.js.map +0 -1
  113. package/dist/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
  114. package/dist/framework/impl/data-element/data-element-date-impl.js +0 -111
  115. package/dist/framework/impl/data-element/data-element-date-impl.js.map +0 -1
  116. package/dist/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
  117. package/dist/framework/impl/data-element/data-element-group-impl.js +0 -130
  118. package/dist/framework/impl/data-element/data-element-group-impl.js.map +0 -1
  119. package/dist/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
  120. package/dist/framework/impl/data-element/data-element-image-impl.js +0 -137
  121. package/dist/framework/impl/data-element/data-element-image-impl.js.map +0 -1
  122. package/dist/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
  123. package/dist/framework/impl/data-element/data-element-list-impl.js +0 -131
  124. package/dist/framework/impl/data-element/data-element-list-impl.js.map +0 -1
  125. package/dist/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
  126. package/dist/framework/impl/data-element/data-element-text-impl.js +0 -103
  127. package/dist/framework/impl/data-element/data-element-text-impl.js.map +0 -1
  128. package/dist/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
  129. package/dist/framework/impl/decorate/fill-null-space-imple.js +0 -43
  130. package/dist/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
  131. package/dist/framework/impl/document/doc-body-impl.d.ts +0 -27
  132. package/dist/framework/impl/document/doc-body-impl.js +0 -79
  133. package/dist/framework/impl/document/doc-body-impl.js.map +0 -1
  134. package/dist/framework/impl/document/doc-body-part-impl.d.ts +0 -30
  135. package/dist/framework/impl/document/doc-body-part-impl.js +0 -94
  136. package/dist/framework/impl/document/doc-body-part-impl.js.map +0 -1
  137. package/dist/framework/impl/document/doc-container-impl.d.ts +0 -16
  138. package/dist/framework/impl/document/doc-container-impl.js +0 -21
  139. package/dist/framework/impl/document/doc-container-impl.js.map +0 -1
  140. package/dist/framework/impl/document/doc-footer-impl.d.ts +0 -26
  141. package/dist/framework/impl/document/doc-footer-impl.js +0 -77
  142. package/dist/framework/impl/document/doc-footer-impl.js.map +0 -1
  143. package/dist/framework/impl/document/doc-header-impl.d.ts +0 -26
  144. package/dist/framework/impl/document/doc-header-impl.js +0 -83
  145. package/dist/framework/impl/document/doc-header-impl.js.map +0 -1
  146. package/dist/framework/impl/document/doc-impl.d.ts +0 -61
  147. package/dist/framework/impl/document/doc-impl.js +0 -209
  148. package/dist/framework/impl/document/doc-impl.js.map +0 -1
  149. package/dist/framework/impl/media-formula/menstrual-history.d.ts +0 -35
  150. package/dist/framework/impl/media-formula/menstrual-history.js +0 -153
  151. package/dist/framework/impl/media-formula/menstrual-history.js.map +0 -1
  152. package/dist/framework/impl/paragraph/p-impl.d.ts +0 -45
  153. package/dist/framework/impl/paragraph/p-impl.js +0 -156
  154. package/dist/framework/impl/paragraph/p-impl.js.map +0 -1
  155. package/dist/framework/impl/picture/image-impl.d.ts +0 -31
  156. package/dist/framework/impl/picture/image-impl.js +0 -124
  157. package/dist/framework/impl/picture/image-impl.js.map +0 -1
  158. package/dist/framework/impl/radio/radio-impl.d.ts +0 -22
  159. package/dist/framework/impl/radio/radio-impl.js +0 -72
  160. package/dist/framework/impl/radio/radio-impl.js.map +0 -1
  161. package/dist/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
  162. package/dist/framework/impl/symbol/br-symbol-impl.js +0 -54
  163. package/dist/framework/impl/symbol/br-symbol-impl.js.map +0 -1
  164. package/dist/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
  165. package/dist/framework/impl/symbol/p-symbol-impl.js +0 -54
  166. package/dist/framework/impl/symbol/p-symbol-impl.js.map +0 -1
  167. package/dist/framework/impl/table/table-cell-impl.d.ts +0 -37
  168. package/dist/framework/impl/table/table-cell-impl.js +0 -145
  169. package/dist/framework/impl/table/table-cell-impl.js.map +0 -1
  170. package/dist/framework/impl/table/table-impl.d.ts +0 -55
  171. package/dist/framework/impl/table/table-impl.js +0 -363
  172. package/dist/framework/impl/table/table-impl.js.map +0 -1
  173. package/dist/framework/impl/table/table-row-impl.d.ts +0 -26
  174. package/dist/framework/impl/table/table-row-impl.js +0 -75
  175. package/dist/framework/impl/table/table-row-impl.js.map +0 -1
  176. package/dist/framework/impl/table/table-split-cell-patch.d.ts +0 -20
  177. package/dist/framework/impl/table/table-split-cell-patch.js +0 -89
  178. package/dist/framework/impl/table/table-split-cell-patch.js.map +0 -1
  179. package/dist/framework/impl/table/table-split-cell.d.ts +0 -90
  180. package/dist/framework/impl/table/table-split-cell.js +0 -464
  181. package/dist/framework/impl/table/table-split-cell.js.map +0 -1
  182. package/dist/framework/impl/table/table-util.d.ts +0 -150
  183. package/dist/framework/impl/table/table-util.js +0 -678
  184. package/dist/framework/impl/table/table-util.js.map +0 -1
  185. package/dist/framework/impl/text/text-impl.d.ts +0 -32
  186. package/dist/framework/impl/text/text-impl.js +0 -149
  187. package/dist/framework/impl/text/text-impl.js.map +0 -1
  188. package/dist/framework/impl/text/track-run-impl.d.ts +0 -27
  189. package/dist/framework/impl/text/track-run-impl.js +0 -112
  190. package/dist/framework/impl/text/track-run-impl.js.map +0 -1
  191. package/dist/framework/notify.d.ts +0 -13
  192. package/dist/framework/notify.js +0 -116
  193. package/dist/framework/notify.js.map +0 -1
  194. package/dist/framework/range-util.d.ts +0 -40
  195. package/dist/framework/range-util.js +0 -312
  196. package/dist/framework/range-util.js.map +0 -1
  197. package/dist/framework/render-context.d.ts +0 -91
  198. package/dist/framework/render-context.js +0 -384
  199. package/dist/framework/render-context.js.map +0 -1
  200. package/dist/framework/render-define.d.ts +0 -109
  201. package/dist/framework/render-define.js +0 -195
  202. package/dist/framework/render-define.js.map +0 -1
  203. package/dist/framework/selection-overlays.d.ts +0 -30
  204. package/dist/framework/selection-overlays.js +0 -124
  205. package/dist/framework/selection-overlays.js.map +0 -1
  206. package/dist/texteditor.d.ts +0 -318
  207. package/dist/texteditor.js +0 -913
  208. package/dist/texteditor.js.map +0 -1
  209. package/dist/util/subject.d.ts +0 -34
  210. package/dist/util/subject.js +0 -88
  211. package/dist/util/subject.js.map +0 -1
  212. package/dist/util/table-bind.d.ts +0 -5
  213. package/dist/util/table-bind.js +0 -6
  214. package/dist/util/table-bind.js.map +0 -1
  215. package/src/med_editor/doc-ruler.ts +0 -340
  216. package/src/med_editor/framework/common-util.ts +0 -200
  217. package/src/med_editor/framework/document-change.ts +0 -1392
  218. package/src/med_editor/framework/document-combine.ts +0 -44
  219. package/src/med_editor/framework/document-comment.ts +0 -168
  220. package/src/med_editor/framework/document-context.ts +0 -410
  221. package/src/med_editor/framework/document-eval-func.ts +0 -53
  222. package/src/med_editor/framework/document-event.ts +0 -1082
  223. package/src/med_editor/framework/document-history.ts +0 -76
  224. package/src/med_editor/framework/document-images-loader.ts +0 -74
  225. package/src/med_editor/framework/document-input-cursor.ts +0 -244
  226. package/src/med_editor/framework/document-paint.ts +0 -110
  227. package/src/med_editor/framework/document-print-offscreen.ts +0 -134
  228. package/src/med_editor/framework/document-print.ts +0 -219
  229. package/src/med_editor/framework/document-segmenter.ts +0 -211
  230. package/src/med_editor/framework/document-selection.ts +0 -391
  231. package/src/med_editor/framework/document-template.ts +0 -20
  232. package/src/med_editor/framework/document-textline-mode.ts +0 -34
  233. package/src/med_editor/framework/element-define.ts +0 -674
  234. package/src/med_editor/framework/element-event-define.ts +0 -142
  235. package/src/med_editor/framework/element-measure.ts +0 -573
  236. package/src/med_editor/framework/element-paint.ts +0 -176
  237. package/src/med_editor/framework/element-props.ts +0 -938
  238. package/src/med_editor/framework/element-reader.ts +0 -159
  239. package/src/med_editor/framework/element-render-cut.ts +0 -456
  240. package/src/med_editor/framework/element-serialize.ts +0 -128
  241. package/src/med_editor/framework/element-util.ts +0 -1565
  242. package/src/med_editor/framework/impl/checkbox/checkbox-impl.ts +0 -71
  243. package/src/med_editor/framework/impl/comments/comment-content-impl.ts +0 -119
  244. package/src/med_editor/framework/impl/comments/comment-element-impl.ts +0 -65
  245. package/src/med_editor/framework/impl/comments/comments-container-impl.ts +0 -68
  246. package/src/med_editor/framework/impl/comments/comments-util.ts +0 -84
  247. package/src/med_editor/framework/impl/comments/validate-msg-impl.ts +0 -94
  248. package/src/med_editor/framework/impl/data-element/data-decorate-impl.ts +0 -95
  249. package/src/med_editor/framework/impl/data-element/data-element-barcode.ts +0 -127
  250. package/src/med_editor/framework/impl/data-element/data-element-base-impl.ts +0 -234
  251. package/src/med_editor/framework/impl/data-element/data-element-check-impl.ts +0 -146
  252. package/src/med_editor/framework/impl/data-element/data-element-date-impl.ts +0 -128
  253. package/src/med_editor/framework/impl/data-element/data-element-group-impl.ts +0 -150
  254. package/src/med_editor/framework/impl/data-element/data-element-image-impl.ts +0 -147
  255. package/src/med_editor/framework/impl/data-element/data-element-list-impl.ts +0 -142
  256. package/src/med_editor/framework/impl/data-element/data-element-text-impl.ts +0 -117
  257. package/src/med_editor/framework/impl/decorate/fill-null-space-imple.ts +0 -48
  258. package/src/med_editor/framework/impl/document/doc-body-impl.ts +0 -95
  259. package/src/med_editor/framework/impl/document/doc-body-part-impl.ts +0 -104
  260. package/src/med_editor/framework/impl/document/doc-container-impl.ts +0 -24
  261. package/src/med_editor/framework/impl/document/doc-footer-impl.ts +0 -88
  262. package/src/med_editor/framework/impl/document/doc-header-impl.ts +0 -100
  263. package/src/med_editor/framework/impl/document/doc-impl.ts +0 -226
  264. package/src/med_editor/framework/impl/media-formula/menstrual-history.ts +0 -175
  265. package/src/med_editor/framework/impl/paragraph/p-impl.ts +0 -190
  266. package/src/med_editor/framework/impl/picture/image-impl.ts +0 -136
  267. package/src/med_editor/framework/impl/radio/radio-impl.ts +0 -79
  268. package/src/med_editor/framework/impl/symbol/br-symbol-impl.ts +0 -60
  269. package/src/med_editor/framework/impl/symbol/p-symbol-impl.ts +0 -57
  270. package/src/med_editor/framework/impl/table/table-cell-impl.ts +0 -156
  271. package/src/med_editor/framework/impl/table/table-impl.ts +0 -401
  272. package/src/med_editor/framework/impl/table/table-row-impl.ts +0 -83
  273. package/src/med_editor/framework/impl/table/table-split-cell-patch.ts +0 -98
  274. package/src/med_editor/framework/impl/table/table-split-cell.ts +0 -475
  275. package/src/med_editor/framework/impl/table/table-util.ts +0 -716
  276. package/src/med_editor/framework/impl/text/text-impl.ts +0 -164
  277. package/src/med_editor/framework/impl/text/track-run-impl.ts +0 -135
  278. package/src/med_editor/framework/notify.ts +0 -130
  279. package/src/med_editor/framework/range-util.ts +0 -321
  280. package/src/med_editor/framework/render-context.ts +0 -431
  281. package/src/med_editor/framework/render-define.ts +0 -224
  282. package/src/med_editor/framework/selection-overlays.ts +0 -134
  283. package/src/med_editor/texteditor.ts +0 -1011
  284. package/src/med_editor/util/subject.ts +0 -118
  285. package/src/med_editor/util/table-bind.ts +0 -6
  286. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +0 -3573
  287. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +0 -3573
  288. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +0 -315
  289. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/211/271/346/263/250.json +0 -122
  290. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/226/207/346/241/243/351/252/214/350/257/201.json +0 -3599
  291. package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/351/225/277/346/226/207/346/234/254.json +0 -24586
  292. package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +0 -2874
  293. package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +0 -341
  294. package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +0 -2201
  295. package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +0 -1069
  296. package/src/med_editor//347/227/205/347/250/213/345/275/225//345/206/205/351/225/234/344/270/213/346/262/273/347/226/227/350/256/260/345/275/225.json +0 -125
  297. package/src/med_editor//347/227/205/347/250/213/345/275/225//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225/346/250/241/346/235/277.json +0 -86
  298. package/src/med_editor//347/227/205/347/250/213/345/275/225//346/227/245/345/270/270/347/227/205/347/250/213/350/256/260/345/275/225.json +0 -115
  299. package/src/med_editor//347/227/205/347/250/213/345/275/225//346/237/245/346/210/277/350/256/260/345/275/2251.json +0 -108
  300. package/src/med_editor//347/227/205/347/250/213/345/275/225//351/246/226/346/254/241/344/270/212/347/272/247/345/214/273/345/270/210/346/237/245/346/210/277/350/256/260/345/275/225.json +0 -272
  301. package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +0 -1070
  302. package/tsconfig.json +0 -25
  303. package/webpack.config.js +0 -46
@@ -1,175 +0,0 @@
1
- import { CommonUtil } from "@/med_editor/framework/common-util";
2
- import { ViewOptions, Element, SerializeProps, ElementFactory, readElementProps, Rect } from "../../element-define";
3
- import { DataEleMHProps, TextProps } from "../../element-props";
4
- import { ElementUtil } from "../../element-util";
5
- import { RenderContenxtType } from "../../render-context";
6
- import { LeafRenderObject, RenderObject } from "../../render-define";
7
- import { DataElementLeaf } from "../data-element/data-element-base-impl";
8
-
9
- /**
10
- * 月经史
11
- */
12
- export class DataElementMH extends DataElementLeaf<DataEleMHProps> {
13
- //props!: DataEleMHProps;
14
- constructor() {
15
- super('data-ele-mh')
16
- this.props = new DataEleMHProps();
17
- //this.addPropValueChangedSub(this.props);
18
- }
19
- setValue(val: DataEleMHProps | string | null): void {
20
- if (typeof val === 'string' && val) {
21
- const items = val.split(';');
22
- if (items.length >= 4) {
23
- const mhLayoutItem = getMHItem(this.props.kind);
24
- this.props[mhLayoutItem.left.prop] = items[0];
25
- this.props[mhLayoutItem.top.prop] = items[1];
26
- this.props[mhLayoutItem.bottom.prop] = items[2];
27
- this.props[mhLayoutItem.right.prop] = items[3];
28
- }
29
- } else if (typeof val === 'object') {
30
- this.props.age = val?.age ?? '';
31
- this.props.days = val?.days ?? '';
32
- this.props.cycles = val?.cycles ?? '';
33
- this.props.lastDate = val?.lastDate ?? '';
34
- this.props.closeAge = val?.closeAge ?? '';
35
- }
36
- }
37
-
38
- getValue() {
39
- const layoutItem = getMHItem(this.props.kind);
40
- return `${this.props[layoutItem.left.prop]};${this.props[layoutItem.top.prop]};${this.props[layoutItem.bottom.prop]};${this.props[layoutItem.right.prop]}`;
41
- }
42
-
43
- createRenderObject(options: ViewOptions, renderCtx: RenderContenxtType): RenderObject<Element> | null {
44
- const render = new DataRenderMH(this);
45
- const measure = renderMH(this, renderCtx, { x: 0, y: 0 }, false);
46
- if (measure) {
47
- render.rect.width = measure.width;
48
- render.rect.height = measure.height;
49
- }
50
- return render;
51
- }
52
- serialize(viewOptions: ViewOptions): SerializeProps | null {
53
- return {
54
- type: this.type,
55
- props: this.props.getSerializeProps(viewOptions)
56
- }
57
- }
58
- clone(data: boolean): Element {
59
- const element = new DataElementMH();
60
- this.props.clone(element.props);
61
- return element;
62
- }
63
-
64
- getCurrentLayoutItem(): MHLayoutType {
65
- return getMHItem(this.props.kind);
66
- }
67
-
68
- }
69
-
70
- type MHLayoutType = {
71
- [key in 'left' | 'top' | 'right' | 'bottom']: {
72
- tip: '初潮年龄' | '行经期天数' | '末次月经时间' | '月经周期天数' | '闭经年龄',
73
- prop: 'age' | 'days' | 'cycles' | 'lastDate' | 'closeAge'
74
- }
75
- }
76
-
77
- const mhLayoutItems: Array<MHLayoutType> = [
78
- { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
79
- { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
80
- { left: { tip: '闭经年龄', prop: 'closeAge' }, top: { tip: '行经期天数', prop: 'days' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } },
81
- { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '月经周期天数', prop: 'cycles' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '行经期天数', prop: 'days' } },
82
- { left: { tip: '初潮年龄', prop: 'age' }, top: { tip: '闭经年龄', prop: 'closeAge' }, right: { tip: '末次月经时间', prop: 'lastDate' }, bottom: { tip: '月经周期天数', prop: 'cycles' } }
83
- ]
84
-
85
-
86
- function getMHItem(kind: string): MHLayoutType {
87
- kind = kind ?? 'A';
88
- kind = kind.toUpperCase();
89
- let kindIndex = ['A', 'B', 'C', 'D', 'E'].indexOf(kind);
90
- kindIndex = kindIndex < 0 ? 0 : kindIndex;
91
- return mhLayoutItems[kindIndex];
92
- }
93
-
94
- export class DataRenderMH extends LeafRenderObject<DataElementMH> {
95
- render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
96
- renderMH(this.element, ctx, position, true);
97
- }
98
-
99
- clone(): RenderObject<Element> {
100
- const clone = new DataRenderMH(this.element);
101
- clone.rect = ElementUtil.cloneRect(this.rect);
102
- return clone;
103
- }
104
- }
105
-
106
- export class DataElementMHFactory extends ElementFactory<DataEleMHProps> {
107
- match(type: string): boolean {
108
- return type === 'data-ele-mh'
109
- }
110
- createElement(data: readElementProps<DataEleMHProps>, renderCtx: RenderContenxtType): Element {
111
- const ele = new DataElementMH();
112
- ElementUtil.readEleBaseProps(ele.props, data.props as DataEleMHProps);
113
- ele.props.age = data.props?.age ?? '';
114
- ele.props.cycles = data.props?.cycles ?? '';
115
- ele.props.days = data.props?.days ?? '';
116
- ele.props.lastDate = data.props?.lastDate ?? '';
117
- ele.props.closeAge = data.props?.closeAge ?? '';
118
- ele.props.kind = data.props?.kind ?? 'A';
119
- return ele;
120
- }
121
-
122
- }
123
-
124
- function renderMH(element: DataElementMH, ctx: RenderContenxtType, position: { x: number; y: number; }, isPaint: boolean): { width: number, height: number } | void {
125
- let { x, y } = position;
126
- const defaultTextProps = new TextProps()
127
- const paddingVer = 2;
128
- const paddingHor = 5;
129
- defaultTextProps.fontSize = 12;
130
- defaultTextProps.fontName = '仿宋';
131
- defaultTextProps.color = "rgb(0,0,0)";
132
- const currentLayout = getMHItem(element.props.kind);
133
- const left = CommonUtil.getEmptyValue(element.props[currentLayout.left.prop], currentLayout.left.tip);
134
- const top = CommonUtil.getEmptyValue(element.props[currentLayout.top.prop], currentLayout.top.tip);
135
- const bottom = CommonUtil.getEmptyValue(element.props[currentLayout.bottom.prop], currentLayout.bottom.tip);
136
- const right = CommonUtil.getEmptyValue(element.props[currentLayout.right.prop], currentLayout.right.tip);
137
- const leftRect = ctx.contentContext.measureText(left, defaultTextProps)
138
- const topRect = ctx.contentContext.measureText(top, defaultTextProps)
139
- const bottomRect = ctx.contentContext.measureText(bottom, defaultTextProps)
140
- const rightRect = ctx.contentContext.measureText(right, defaultTextProps)
141
- let height = topRect.height + bottomRect.height;
142
- const middleWidth = Math.max(topRect.width, bottomRect.width)
143
- let width = leftRect.width + middleWidth + rightRect.width;
144
- if (!isPaint) {
145
- return { width: width + paddingHor * 2, height: height + paddingVer * 2 }
146
- }
147
- x += paddingHor;
148
- y += paddingVer;
149
- //年龄
150
- ctx.contentContext.drawText(left, defaultTextProps, x, y + (height - leftRect.height) / 2, leftRect.width, leftRect.height)
151
- x += leftRect.width;
152
- //天数
153
- ctx.contentContext.drawText(top, defaultTextProps, x + (middleWidth - topRect.width) / 2, y - 2, topRect.width, topRect.height);
154
- //分割线
155
- ctx.contentContext.drawLine(x, y + topRect.height, middleWidth)
156
- //周期
157
- ctx.contentContext.drawText(bottom, defaultTextProps, x + (middleWidth - bottomRect.width) / 2, y + topRect.height + 2, bottomRect.width, bottomRect.height);
158
- //末次时间
159
- x += middleWidth;
160
- ctx.contentContext.drawText(right, defaultTextProps, x, y + (height - leftRect.height) / 2, rightRect.width, rightRect.height)
161
-
162
- if (ctx.drawMode === 'view') {
163
- let { x, y } = position;
164
- width = width + paddingHor * 2;
165
- height = height + paddingVer * 2;
166
- //const { width, height } = this.rect;
167
- const lineWidth = 3;
168
- const paintColor = '#0050b3';
169
- ctx.contentContext.strokeLines([{ x: x + lineWidth, y }, { x, y }, { x, y: y + height }, { x: x + lineWidth, y: y + height }], 1, paintColor);
170
- x = x + width;
171
- ctx.contentContext.strokeLines([{ x: x - lineWidth, y }, { x, y }, { x, y: y + height }, { x: x - lineWidth, y: y + height }], 1, paintColor);
172
- }
173
- }
174
-
175
-
@@ -1,190 +0,0 @@
1
- import {
2
- BlockContentElement,
3
- ElementFactory,
4
- Element,
5
- SerializeProps,
6
- ViewOptions,
7
- readElementProps
8
- } from "@/med_editor/framework/element-define";
9
- import { ContextMenuElementEvent } from "@/med_editor/framework/element-event-define";
10
- import { ParagraphProps } from "@/med_editor/framework/element-props";
11
- import { ElementUtil } from "@/med_editor/framework/element-util";
12
- import { RenderContenxtType } from "@/med_editor/framework/render-context";
13
- import {
14
- BlockLineRectRenderObject,
15
- MuiltBlockLineRenderObject,
16
- RenderObject
17
- } from "@/med_editor/framework/render-define";
18
-
19
- export class ParagraphElement extends BlockContentElement<ParagraphProps> {
20
- //props: ParagraphProps;
21
- constructor() {
22
- super('p');
23
- this.props = new ParagraphProps();
24
- //this.addPropValueChangedSub(this.props);
25
- this.addEvent('BackspaceKey', (evt) => {
26
- if (evt.selectionState.collapsed) {
27
- const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
28
- if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
29
- if (this.props.numberType >= 0) {
30
- this.props.numberType = -1;
31
- evt.isCancel = true;
32
- } else if (this.props.indent) {
33
- this.props.indent = 0;
34
- evt.isCancel = true;
35
- }
36
- }
37
- }
38
-
39
- }, true);
40
- this.addEvent<ContextMenuElementEvent>('ElementContextMenu', (evt) => {
41
- const { selectionState } = evt;
42
- evt.menus.push({
43
- icon: 'DeleteTable', caption: '删除段落', eventObj: {
44
- onClick: (cevt) => {
45
- selectionState.clear();
46
- const psymbol = ElementUtil.getLastLeafElement(this);
47
- const nextFocusableEle = ElementUtil.getRecursionNextSiblingElement(psymbol, false, true);
48
- if (nextFocusableEle) {
49
- selectionState.resetRange(nextFocusableEle, 0);
50
- } else {
51
- selectionState.clear();
52
- }
53
- this.remove();
54
- this.destroy();
55
- }
56
- }
57
- });
58
- });
59
- }
60
-
61
- createRenderObject(): ParagraphRenderObject {
62
- const paraRender = new ParagraphRenderObject(this);
63
- return paraRender;
64
- }
65
-
66
- serialize(viewOptions: ViewOptions): SerializeProps {
67
- return {
68
- type: 'p',
69
- props: {
70
- ...this.props.getSerializeProps(viewOptions)
71
- }
72
- }
73
- }
74
-
75
- clone(data: boolean): Element {
76
- const clone = new ParagraphElement();
77
- this.props.clone(clone.props);
78
- if (data) {
79
- for (let i = 0; i < this.length; i++) {
80
- clone.addChild(this.getChild(i).clone(true));
81
- }
82
- }
83
- return clone;
84
- }
85
-
86
- static createElement(): ParagraphElement {
87
- return new ParagraphElement();
88
- }
89
-
90
- }
91
-
92
- export class ParagraphRenderObject extends MuiltBlockLineRenderObject {
93
- beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
94
- }
95
-
96
- endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
97
- this.drawProjectNumber(ctx);
98
- }
99
-
100
-
101
- /**
102
- * 绘制项目符号
103
- */
104
- drawProjectNumber(ctx: RenderContenxtType): void {
105
- const paraElement = this.element as ParagraphElement;
106
- if (paraElement.props.numberType >= 0) {
107
- if (paraElement.paintRenders.indexOf(this) > 0) {
108
- return;
109
- }
110
- const firstLine = this.getChild(0) as ParagraphLineRectRenderObject;
111
- if (!firstLine) {
112
- debugger;
113
- }
114
- const firstInline = firstLine.getChild(0);
115
- if (!firstInline) {
116
- debugger;
117
- }
118
- const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
119
- x: 0,
120
- y: -ctx.viewOptions.translateY
121
- });
122
- const numberSymbolY = firstInlinePaintPos.y + Math.ceil(firstInline.rect.height / 2);
123
- //ctx.contentContext.drawText(str, textProps, firstInlinePaintPos.x - paraElement.paraProps.indent, numberSymbolY, 14, 14);
124
- ctx.contentContext.fillCircular(firstInlinePaintPos.x - paraElement.props.indent + 2, numberSymbolY, 4)
125
- }
126
- }
127
-
128
-
129
- clone(): RenderObject {
130
- const cloneRender = new ParagraphRenderObject(this.element);
131
- cloneRender.rect = ElementUtil.cloneRect(this.rect);
132
- for (let i = 0; i < this.length; i++) {
133
- cloneRender.addChild(this.getChild(i).clone());
134
- }
135
- return cloneRender;
136
- }
137
-
138
- createLineRect(): ParagraphLineRectRenderObject {
139
- const lineRect = new ParagraphLineRectRenderObject(this.element);
140
- lineRect.rect.maxWidth = this.rect.maxWidth;
141
- return lineRect;
142
- }
143
-
144
-
145
- }
146
-
147
- export class ParagraphFactory extends ElementFactory<ParagraphProps> {
148
- match(type: string): boolean {
149
- return type === 'p';
150
- }
151
-
152
- createElement(data: readElementProps<ParagraphProps>, renderCtx: RenderContenxtType): Element {
153
- const paraElement = new ParagraphElement();
154
- const props = data.props;
155
- paraElement.props.indent = props?.indent ?? 0;
156
- paraElement.props.hanging = props?.hanging ?? 0;
157
- paraElement.props.textAlign = props?.textAlign ?? 'left';
158
- paraElement.props.numberType = props?.numberType ?? -1;
159
- paraElement.props.lineHeight = props?.lineHeight ?? 1.3;
160
- paraElement.props.textProps = ElementUtil.readTextProps(null, props?.textProps, renderCtx.viewOptions);
161
- paraElement.props.pageBreak = props?.pageBreak ?? false;
162
- return paraElement;
163
- }
164
- }
165
-
166
- /**
167
- * 段落行框
168
- */
169
- export class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
170
-
171
- beginRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
172
- //console.log('绘制段落行-begin');
173
-
174
- }
175
-
176
- endRender(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
177
- //console.log('绘制段落行-end');
178
- //ctx.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
179
- }
180
-
181
-
182
- clone(): RenderObject {
183
- const cloneRender = new ParagraphLineRectRenderObject(this.element);
184
- cloneRender.rect = ElementUtil.cloneRect(this.rect);
185
- for (let i = 0; i < this.length; i++) {
186
- cloneRender.addChild(this.getChild(i).clone());
187
- }
188
- return cloneRender;
189
- }
190
- }
@@ -1,136 +0,0 @@
1
- import { Element, ElementFactory, ImgLoadStatus, LeafElement, Position, ResizeLeafRenderObject, SerializeProps, ViewOptions } from "@/med_editor/framework/element-define";
2
- import { PictureProps } from "@/med_editor/framework/element-props";
3
- import { ElementUtil } from "@/med_editor/framework/element-util";
4
- import { RenderContenxtType } from "@/med_editor/framework/render-context";
5
- import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
6
-
7
-
8
- interface IResizeElement {
9
- resizeable: boolean;
10
- }
11
- export class PictureElement extends LeafElement<PictureProps> implements IResizeElement {
12
- //props: PictureProps;
13
- status: ImgLoadStatus = 'no';
14
- resizeable: boolean = true;
15
- constructor() {
16
- super('img');
17
- this.props = new PictureProps();
18
- //this.addPropValueChangedSub(this.props);
19
- this.cursorType = 'move'
20
- this.focusable = true;
21
- }
22
- createRenderObject(): LeafRenderObject {
23
- const render = new PictureRenderObject(this);
24
- render.rect.width = this.props.width + 2;
25
- render.rect.height = this.props.height + 2;
26
- return render;
27
- }
28
- serialize(options: ViewOptions): SerializeProps {
29
- return {
30
- type: 'img',
31
- props: {
32
- ...this.props.getSerializeProps(options)
33
- }
34
- }
35
- }
36
- clone(data: boolean): Element {
37
- const clone = new PictureElement();
38
- this.props.clone(clone.props);
39
- return clone;
40
- }
41
-
42
- loadImage(ctx: RenderContenxtType): void {
43
- if (this.status === 'no') {
44
- this.status = 'loading';
45
- //this.imageSource = new Image();
46
- //this.imageSource.src = this.props.src;
47
- // const onload = (e: any) => {
48
- // this.isLoad = 'completed';
49
- // this.refreshView('appearance');
50
- // };
51
- // const onerror = (e: any) => {
52
- // this.isLoad = 'error';
53
- // console.error(e);
54
- // };
55
- const onCallback = (status: ImgLoadStatus) => {
56
- this.status = status;
57
- if (status === 'completed') {
58
- this.refreshView();
59
- }
60
- }
61
- ctx.docCtx.imageLoader.loadImage(this.props.src, onCallback);
62
- }
63
- }
64
- destroy(): void {
65
- super.destroy();
66
- }
67
- }
68
-
69
- export class PictureRenderObject extends ResizeLeafRenderObject {
70
- render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
71
- const picElement = this.element as PictureElement;
72
- const picProps = picElement.props;
73
- if (picElement.status === 'no') {
74
- picElement.loadImage(ctx);
75
- return;
76
- }
77
- if (picElement.status === 'completed') {
78
- const imageSource = ctx.docCtx.imageLoader.getImage(picProps.src);
79
- if (!imageSource) {
80
- return;
81
- }
82
- if (picProps.border === 'all') {
83
- ctx.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black');
84
- }
85
- ctx.contentContext.drawImage(imageSource, 0, 0, imageSource.naturalWidth, imageSource.naturalHeight, position.x + 2, position.y + 2, picProps.width, picProps.height);
86
- }
87
- }
88
- clone(): RenderObject {
89
- const clone = new PictureRenderObject(this.element);
90
- clone.rect = ElementUtil.cloneRect(this.rect);
91
- return clone;
92
- }
93
-
94
- pagePaintCompleted(ctx: RenderContenxtType, pos: Position): void {
95
- if (this.element.isFocused) {
96
- const { width, height } = this.rect;
97
- ctx.contentContext.strokeRect(pos.x, pos.y, width, height, '#1890ff', 0.5);
98
- this.drawResizeCircle(ctx, pos.x, pos.y);
99
- this.drawResizeCircle(ctx, pos.x + width, pos.y);
100
- this.drawResizeCircle(ctx, pos.x, pos.y + height);
101
- this.drawResizeCircle(ctx, pos.x + width, pos.y + height);
102
- this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y);
103
- this.drawResizeCircle(ctx, pos.x + (Math.floor(width / 2)), pos.y + height);
104
- this.drawResizeCircle(ctx, pos.x, pos.y + (Math.floor(height / 2)));
105
- this.drawResizeCircle(ctx, pos.x + width, pos.y + (Math.floor(height / 2)));
106
- }
107
- }
108
-
109
- private drawResizeCircle(ctx: RenderContenxtType, x: number, y: number): void {
110
- const ctxNative = ctx.contentContext.ctx;
111
- ctxNative.fillStyle = '#69c0ff';
112
- ctxNative.beginPath();
113
- ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
114
- ctxNative.closePath();
115
- ctxNative.fill();
116
- }
117
- }
118
-
119
-
120
- export class PictureFactory extends ElementFactory<PictureProps> {
121
- match(type: string): boolean {
122
- return type === 'img';
123
- }
124
- createElement(data: any, renderCtx: RenderContenxtType): Element {
125
- const props = data.props as PictureProps;
126
- const pic = new PictureElement();
127
- const picProps = pic.props;
128
- picProps.width = props.width;
129
- picProps.height = props.height;
130
- picProps.src = props.src;
131
- picProps.border = props.border || 'all';
132
- picProps.title = props.title;
133
- pic.props = picProps;
134
- return pic;
135
- }
136
- }
@@ -1,79 +0,0 @@
1
- import { ElementFactory, LeafElement, SerializeProps } from "@/med_editor/framework/element-define";
2
- import { RadioBoxProps } from "@/med_editor/framework/element-props";
3
- import { ElementUtil } from "@/med_editor/framework/element-util";
4
- import { RenderContenxtType } from "@/med_editor/framework/render-context";
5
- import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
6
-
7
- export class RadioBoxElement extends LeafElement<RadioBoxProps> {
8
- //props: RadioBoxProps;
9
- constructor() {
10
- super('rd');
11
- this.props = new RadioBoxProps();
12
- //this.addPropValueChangedSub(this.props);
13
- this.cursorType = 'default'
14
- this.addEvent('ElementClick', (evt) => { this.changeState() });
15
- }
16
- createRenderObject(): RadioBoxRenderObject {
17
- const render = new RadioBoxRenderObject(this);
18
- render.rect.width = this.props.size + 4;
19
- render.rect.height = this.props.size;
20
- return render;
21
- }
22
-
23
- changeState(): void {
24
- const parent = this.parent;
25
- if (!parent) {
26
- throw new Error('parent is null')
27
- }
28
- for (let i = 0; i < parent.length; i++) {
29
- const child = parent.getChild(i);
30
- if (child instanceof RadioBoxElement && child !== this) {
31
- child.props.isChecked = false;
32
- }
33
- }
34
- this.props.isChecked = true;
35
- }
36
- serialize(): SerializeProps {
37
- return {
38
- type: 'rd',
39
- props: {
40
- ...this.props
41
- }
42
- }
43
- }
44
- clone(): RadioBoxElement {
45
- const clone = new RadioBoxElement();
46
- this.props.clone(clone.props);
47
- return clone;
48
- }
49
- }
50
-
51
- export class RadioBoxFactory extends ElementFactory<RadioBoxProps> {
52
- match(type: string): boolean {
53
- return type === 'rd';
54
- }
55
- createElement(data: any, renderCtx: RenderContenxtType): RadioBoxElement {
56
- const rdElement = new RadioBoxElement();
57
- const props = data.props as RadioBoxProps;
58
- const ckbProps = rdElement.props;
59
- ckbProps.size = props.size ?? 14;
60
- ckbProps.isChecked = props.isChecked;
61
- rdElement.props = ckbProps;
62
- return rdElement;
63
- }
64
- }
65
-
66
- export class RadioBoxRenderObject extends LeafRenderObject {
67
-
68
- render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
69
- const element = this.element as RadioBoxElement;
70
- ctx.contentContext.drawRadioBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.isChecked);
71
- }
72
-
73
- clone(cloneData = true): RenderObject {
74
- const clone = new RadioBoxRenderObject(this.element);
75
- clone.rect = ElementUtil.cloneRect(this.rect);
76
- return clone;
77
- }
78
-
79
- }
@@ -1,60 +0,0 @@
1
- import { Element, ElementFactory, LeafElement, SerializeProps } from "@/med_editor/framework/element-define";
2
- import { ElementUtil } from "@/med_editor/framework/element-util";
3
- import { RenderContenxtType } from "@/med_editor/framework/render-context";
4
- import { LeafRenderObject, RenderObject } from "@/med_editor/framework/render-define";
5
- import { TextProps } from "../../element-props";
6
-
7
- export class BreakElement extends LeafElement {
8
- textProps: TextProps;
9
- constructor() {
10
- super('br');
11
- this.textProps = new TextProps();
12
- this.textProps.fontSize = 14;
13
- this.textProps.fontName = '宋体';
14
- this.textProps.color = '#595959';
15
- }
16
- createRenderObject(): LeafRenderObject {
17
- const symbol = new BreakRenderObject(this);
18
- symbol.rect.height = 14;
19
- symbol.rect.width = 7;
20
- return symbol;
21
- }
22
- serialize(): SerializeProps {
23
- return {
24
- type: 'br',
25
- props: {}
26
- }
27
- }
28
- clone(): Element {
29
- const clone = new BreakElement();
30
- //clone.renderCtx = this.renderCtx;
31
- return clone;
32
- }
33
-
34
- }
35
-
36
- export class BreakRenderObject extends LeafRenderObject<BreakElement> {
37
- render(ctx: RenderContenxtType, position: { x: number; y: number; }): void {
38
- if (ctx.drawMode === 'print') {
39
- return;
40
- }
41
- ctx.contentContext.drawText('↓', this.element.textProps, position.x, position.y, 20, this.rect.height);
42
- }
43
- clone(): RenderObject {
44
- const render = new BreakRenderObject(this.element);
45
- render.rect = ElementUtil.cloneRect(this.rect);
46
- return render;
47
- }
48
- }
49
-
50
- export class BreakFactory extends ElementFactory<null> {
51
- match(type: string): boolean {
52
- return type === 'br';
53
- }
54
- createElement(data: any, renderCtx: RenderContenxtType): Element {
55
- const ele = new BreakElement();
56
- return ele;
57
- }
58
-
59
- }
60
-