@fishawack/lab-velocity 1.11.1 → 2.0.0-beta.10

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 (138) hide show
  1. package/README.md +177 -49
  2. package/_Build/vue/components/Icon.vue +33 -0
  3. package/_Build/vue/components/Svg.vue +45 -0
  4. package/{basic → _Build/vue/components/basic}/Button.vue +17 -19
  5. package/{basic → _Build/vue/components/basic}/link.vue +8 -7
  6. package/{form → _Build/vue/components/form}/Cascader.vue +13 -13
  7. package/{form → _Build/vue/components/form}/CheckboxGroup.vue +28 -6
  8. package/{form → _Build/vue/components/form}/DatePicker.vue +23 -7
  9. package/{form → _Build/vue/components/form}/InputNumber.vue +1 -2
  10. package/{form → _Build/vue/components/form}/Select.vue +10 -11
  11. package/_Build/vue/components/form/Spinner.vue +5 -0
  12. package/{form → _Build/vue/components/form}/Switch.vue +2 -2
  13. package/{form → _Build/vue/components/form}/Upload.vue +4 -6
  14. package/{form → _Build/vue/components/form}/Wysiwyg.vue +14 -14
  15. package/_Build/vue/components/form/Wysiwyg2.vue +577 -0
  16. package/{form → _Build/vue/components/form}/basic.vue +25 -7
  17. package/{form → _Build/vue/components/form}/file.vue +1 -1
  18. package/{form → _Build/vue/components/form}/input.js +2 -2
  19. package/{form → _Build/vue/components/form}/input.vue +31 -11
  20. package/{layout → _Build/vue/components/layout}/Alert.vue +10 -10
  21. package/_Build/vue/components/layout/Footer.vue +50 -0
  22. package/{layout → _Build/vue/components/layout}/Header.vue +5 -7
  23. package/_Build/vue/components/layout/Loader.vue +59 -0
  24. package/{layout → _Build/vue/components/layout}/Tooltip.vue +12 -12
  25. package/{layout → _Build/vue/components/layout}/pageTitle.vue +4 -4
  26. package/{layout → _Build/vue/components/layout}/sideBar.vue +4 -6
  27. package/{navigation → _Build/vue/components/navigation}/Breadcrumbs.vue +15 -10
  28. package/{navigation → _Build/vue/components/navigation}/BreadcrumbsItem.vue +6 -6
  29. package/_Build/vue/components/navigation/Menu.vue +14 -0
  30. package/_Build/vue/components/navigation/MenuItem.vue +20 -0
  31. package/_Build/vue/components/navigation/MenuItemGroup.vue +20 -0
  32. package/_Build/vue/components/navigation/SubMenu.vue +20 -0
  33. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +259 -0
  34. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +62 -0
  35. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +98 -0
  36. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +90 -0
  37. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +181 -0
  38. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +267 -0
  39. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +36 -0
  40. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +113 -0
  41. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +101 -0
  42. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +112 -0
  43. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +174 -0
  44. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +123 -0
  45. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +36 -0
  46. package/{AuthModule → _Build/vue/modules/AuthModule}/components/AuthModal.vue +30 -35
  47. package/_Build/vue/modules/AuthModule/components/Chip.vue +70 -0
  48. package/_Build/vue/modules/AuthModule/components/Chips.vue +26 -0
  49. package/_Build/vue/modules/AuthModule/components/FormRole.vue +117 -0
  50. package/_Build/vue/modules/AuthModule/components/VBreadcrumbs.vue +33 -0
  51. package/_Build/vue/modules/AuthModule/components/VFormFooter.vue +52 -0
  52. package/_Build/vue/modules/AuthModule/components/VPageHeader.vue +38 -0
  53. package/_Build/vue/modules/AuthModule/components/VPasswordValidation.vue +106 -0
  54. package/_Build/vue/modules/AuthModule/components/VRoleLegend.vue +43 -0
  55. package/_Build/vue/modules/AuthModule/components/VTable.vue +136 -0
  56. package/_Build/vue/modules/AuthModule/components/VTableSorter.vue +252 -0
  57. package/_Build/vue/modules/AuthModule/js/FakeAPI.js +78 -0
  58. package/_Build/vue/modules/AuthModule/js/axios.js +81 -0
  59. package/_Build/vue/modules/AuthModule/js/router.js +295 -0
  60. package/_Build/vue/modules/AuthModule/js/store.js +62 -0
  61. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/account-exists.vue +6 -8
  62. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/change-password.vue +39 -38
  63. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/container.vue +4 -8
  64. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/expired-reset.vue +17 -15
  65. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/expired-verification.vue +21 -20
  66. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/force-reset.vue +45 -40
  67. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/forgot.vue +15 -11
  68. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/login.vue +27 -26
  69. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/logincallback.vue +6 -13
  70. package/_Build/vue/modules/AuthModule/routes/loginheadless.vue +21 -0
  71. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/loginsso.vue +34 -29
  72. package/_Build/vue/modules/AuthModule/routes/logout.vue +19 -0
  73. package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +25 -0
  74. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/register.vue +52 -37
  75. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/reset.vue +29 -19
  76. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/success-forgot.vue +22 -19
  77. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/success-reset.vue +6 -6
  78. package/_Build/vue/modules/AuthModule/routes/success-verify.vue +30 -0
  79. package/{AuthModule → _Build/vue/modules/AuthModule}/routes/verify.vue +26 -26
  80. package/_base.scss +0 -1
  81. package/_defaults.scss +3 -15
  82. package/_variables.scss +24 -21
  83. package/components/_alert.scss +2 -2
  84. package/components/_auth.scss +163 -0
  85. package/components/_basic.scss +5 -4
  86. package/components/_breadcrumbs.scss +7 -8
  87. package/components/_button.scss +11 -12
  88. package/components/_cascader.scss +1 -1
  89. package/components/_checkbox.scss +27 -26
  90. package/components/_chip.scss +24 -0
  91. package/components/_collapse.scss +2 -3
  92. package/components/_datepicker.scss +7 -6
  93. package/components/_footer.scss +1 -1
  94. package/components/_form.scss +6 -4
  95. package/components/_header.scss +4 -5
  96. package/components/_icon.scss +4 -3
  97. package/components/_inputNumber.scss +4 -3
  98. package/components/_link.scss +7 -7
  99. package/components/_loader.scss +3 -4
  100. package/components/_menu.scss +22 -22
  101. package/{modules → components}/_modal.scss +3 -3
  102. package/components/_pageTitle.scss +3 -3
  103. package/components/_permissionLegend.scss +18 -0
  104. package/components/_select.scss +3 -2
  105. package/components/_sidebar.scss +5 -6
  106. package/components/_switch.scss +2 -2
  107. package/components/_table.scss +3 -3
  108. package/components/_tooltip.scss +2 -2
  109. package/components/_typography.scss +71 -62
  110. package/components/_upload.scss +1 -1
  111. package/components/_wysiwyg.scss +3 -2
  112. package/components/_wysiwyg2.scss +37 -31
  113. package/general.scss +1 -2
  114. package/index.js +38 -30
  115. package/package.json +104 -102
  116. package/vendor.scss +2 -3
  117. package/AuthModule/components/VPasswordValidation.vue +0 -66
  118. package/AuthModule/js/AuthAxios.js +0 -59
  119. package/AuthModule/js/AuthRoutes.js +0 -186
  120. package/AuthModule/js/AuthStore.js +0 -99
  121. package/AuthModule/js/FakeAPI.js +0 -84
  122. package/AuthModule/routes/loginheadless.vue +0 -16
  123. package/AuthModule/routes/logout.vue +0 -21
  124. package/AuthModule/routes/success-verify.vue +0 -29
  125. package/Icon.vue +0 -33
  126. package/Svg.vue +0 -40
  127. package/components/_input.scss +0 -0
  128. package/form/Wysiwyg2.vue +0 -278
  129. package/layout/Footer.vue +0 -35
  130. package/layout/Loader.vue +0 -39
  131. package/modules/_AuthModule.scss +0 -209
  132. package/modules/_AuthVariables.scss +0 -7
  133. package/navigation/Menu.vue +0 -16
  134. package/navigation/MenuItem.vue +0 -20
  135. package/navigation/MenuItemGroup.vue +0 -20
  136. package/navigation/SubMenu.vue +0 -20
  137. /package/{form → _Build/vue/components/form}/Checkbox.vue +0 -0
  138. /package/{form → _Build/vue/components/form}/color.vue +0 -0
@@ -28,8 +28,7 @@
28
28
  <template #tip>
29
29
  <slot name="tip" />
30
30
  </template>
31
- <slot name="default">
32
- </slot>
31
+ <slot name="default"> </slot>
33
32
  </el-upload>
34
33
  </XInput>
35
34
  </template>
@@ -58,7 +57,7 @@ export default {
58
57
  },
59
58
  autoUpload: {
60
59
  type: Boolean,
61
- default: false
60
+ default: false,
62
61
  },
63
62
  onExceed: {
64
63
  type: Function,
@@ -96,8 +95,7 @@ export default {
96
95
  },
97
96
  handleStart(file) {
98
97
  this.$refs.upload.handleStart(file);
99
- }
100
- }
101
-
98
+ },
99
+ },
102
100
  };
103
101
  </script>
@@ -11,7 +11,7 @@
11
11
  import Quill from "quill";
12
12
  import input from "./input.js";
13
13
  import XInput from "./input.vue";
14
- import sanitizeHtml from 'sanitize-html';
14
+ import sanitizeHtml from "sanitize-html";
15
15
 
16
16
  export default {
17
17
  mixins: [input],
@@ -51,10 +51,10 @@ export default {
51
51
  return this.editor.getText().trim() === "" // Quill leaves <p></br></p> on empty input so ignore
52
52
  ? ""
53
53
  : this.simple // Simple editor removes outer tags and only allows inner phrasing tags
54
- ? [...this.editor.root.children]
55
- .map((d) => d.innerHTML)
56
- .join("\n")
57
- : this.editor.root.innerHTML;
54
+ ? [...this.editor.root.children]
55
+ .map((d) => d.innerHTML)
56
+ .join("\n")
57
+ : this.editor.root.innerHTML;
58
58
  },
59
59
  setValue() {
60
60
  const temp =
@@ -65,19 +65,19 @@ export default {
65
65
  },
66
66
  // Function to remove p tags from inside li tags, breaks the wysiwyg
67
67
  formatCleaner(unformmatted) {
68
- if(!unformmatted) {
68
+ if (!unformmatted) {
69
69
  return "";
70
70
  }
71
- let parser = document.createElement('div');
72
- parser.innerHTML = unformmatted.replace(/(\r\n|\n|\r|\t)/gm,"");
73
- const lists = parser.getElementsByTagName('ul');
74
- for(var x = 0; x < lists.length; x++) {
71
+ let parser = document.createElement("div");
72
+ parser.innerHTML = unformmatted.replace(/(\r\n|\n|\r|\t)/gm, "");
73
+ const lists = parser.getElementsByTagName("ul");
74
+ for (var x = 0; x < lists.length; x++) {
75
75
  lists[x].innerHTML = sanitizeHtml(lists[x].innerHTML, {
76
- allowedTags: [ 'b', 'i', 'em', 'strong', 'a','li']
76
+ allowedTags: ["b", "i", "em", "strong", "a", "li"],
77
77
  });
78
78
  }
79
79
  return parser.innerHTML;
80
- }
80
+ },
81
81
  },
82
82
 
83
83
  mounted() {
@@ -100,7 +100,7 @@ export default {
100
100
  this.simple ? undefined : { list: "ordered" },
101
101
  this.simple ? undefined : { list: "bullet" },
102
102
  "clean",
103
- "link"
103
+ "link",
104
104
  ],
105
105
  ],
106
106
  },
@@ -120,7 +120,7 @@ export default {
120
120
 
121
121
  // Disable tab index on toolbar buttons
122
122
  [...this.$el.querySelectorAll(".ql-toolbar button")].forEach((d) =>
123
- d.setAttribute("tabindex", -1)
123
+ d.setAttribute("tabindex", -1),
124
124
  );
125
125
  },
126
126
  };
@@ -0,0 +1,577 @@
1
+ <template>
2
+ <XInput v-bind="$props" class="vel-wysiwyg">
3
+ <template #label>
4
+ <slot name="label" />
5
+ </template>
6
+ <div class="control-group vel-wysiwyg__controls" v-if="editor">
7
+ <el-dropdown>
8
+ Heading
9
+ <template #dropdown>
10
+ <el-dropdown-menu>
11
+ <el-dropdown-item
12
+ @click="
13
+ editor
14
+ .chain()
15
+ .focus()
16
+ .toggleHeading({ level: 1 })
17
+ .run()
18
+ "
19
+ :class="{
20
+ 'is-active': editor.isActive('heading', {
21
+ level: 1,
22
+ }),
23
+ }"
24
+ >
25
+ H1
26
+ </el-dropdown-item>
27
+ <el-dropdown-item
28
+ @click="
29
+ editor
30
+ .chain()
31
+ .focus()
32
+ .toggleHeading({ level: 2 })
33
+ .run()
34
+ "
35
+ :class="{
36
+ 'is-active': editor.isActive('heading', {
37
+ level: 2,
38
+ }),
39
+ }"
40
+ >
41
+ H2
42
+ </el-dropdown-item>
43
+ <el-dropdown-item
44
+ @click="
45
+ editor
46
+ .chain()
47
+ .focus()
48
+ .toggleHeading({ level: 3 })
49
+ .run()
50
+ "
51
+ :class="{
52
+ 'is-active': editor.isActive('heading', {
53
+ level: 3,
54
+ }),
55
+ }"
56
+ >
57
+ H3
58
+ </el-dropdown-item>
59
+ <el-dropdown-item
60
+ @click="
61
+ editor
62
+ .chain()
63
+ .focus()
64
+ .toggleHeading({ level: 4 })
65
+ .run()
66
+ "
67
+ :class="{
68
+ 'is-active': editor.isActive('heading', {
69
+ level: 4,
70
+ }),
71
+ }"
72
+ >
73
+ H4
74
+ </el-dropdown-item>
75
+ <el-dropdown-item
76
+ @click="
77
+ editor
78
+ .chain()
79
+ .focus()
80
+ .toggleHeading({ level: 5 })
81
+ .run()
82
+ "
83
+ :class="{
84
+ 'is-active': editor.isActive('heading', {
85
+ level: 5,
86
+ }),
87
+ }"
88
+ >
89
+ H5
90
+ </el-dropdown-item>
91
+ <el-dropdown-item
92
+ @click="
93
+ editor
94
+ .chain()
95
+ .focus()
96
+ .toggleHeading({ level: 6 })
97
+ .run()
98
+ "
99
+ :class="{
100
+ 'is-active': editor.isActive('heading', {
101
+ level: 6,
102
+ }),
103
+ }"
104
+ >
105
+ H6
106
+ </el-dropdown-item>
107
+ <el-dropdown-item
108
+ @click="editor.chain().focus().setParagraph().run()"
109
+ :class="{
110
+ 'is-active': editor.isActive('paragraph'),
111
+ }"
112
+ >
113
+ Paragraph
114
+ </el-dropdown-item>
115
+ </el-dropdown-menu>
116
+ </template>
117
+ </el-dropdown>
118
+ <el-dropdown>
119
+ Style
120
+ <template #dropdown>
121
+ <el-dropdown-menu>
122
+ <el-dropdown-item
123
+ class="vel-wysiwyg__button"
124
+ @click="editor.chain().focus().toggleBold().run()"
125
+ :disabled="
126
+ !editor.can().chain().focus().toggleBold().run()
127
+ "
128
+ :class="{ 'is-active': editor.isActive('bold') }"
129
+ >Bold</el-dropdown-item
130
+ >
131
+ <el-dropdown-item
132
+ class="vel-wysiwyg__button"
133
+ @click="editor.chain().focus().toggleItalic().run()"
134
+ :disabled="
135
+ !editor
136
+ .can()
137
+ .chain()
138
+ .focus()
139
+ .toggleItalic()
140
+ .run()
141
+ "
142
+ :class="{ 'is-active': editor.isActive('italic') }"
143
+ >Italic</el-dropdown-item
144
+ >
145
+ <el-dropdown-item
146
+ class="vel-wysiwyg__button"
147
+ @click="
148
+ editor.chain().focus().toggleUnderline().run()
149
+ "
150
+ :disabled="
151
+ !editor
152
+ .can()
153
+ .chain()
154
+ .focus()
155
+ .toggleUnderline()
156
+ .run()
157
+ "
158
+ :class="{
159
+ 'is-active': editor.isActive('underline'),
160
+ }"
161
+ >Underline</el-dropdown-item
162
+ >
163
+ </el-dropdown-menu>
164
+ </template>
165
+ </el-dropdown>
166
+ <el-dropdown v-if="table">
167
+ Table
168
+ <template #dropdown>
169
+ <el-dropdown-menu>
170
+ <el-dropdown-item
171
+ @click="
172
+ editor
173
+ .chain()
174
+ .focus()
175
+ .insertTable({
176
+ rows: 3,
177
+ cols: 3,
178
+ withHeaderRow: true,
179
+ })
180
+ .run()
181
+ "
182
+ >
183
+ Insert table
184
+ </el-dropdown-item>
185
+ <el-dropdown-item
186
+ @click="
187
+ editor.chain().focus().addColumnBefore().run()
188
+ "
189
+ >
190
+ Add column before
191
+ </el-dropdown-item>
192
+ <el-dropdown-item
193
+ @click="
194
+ editor.chain().focus().addColumnAfter().run()
195
+ "
196
+ >
197
+ Add column after
198
+ </el-dropdown-item>
199
+ <el-dropdown-item
200
+ @click="editor.chain().focus().deleteColumn().run()"
201
+ >
202
+ Delete column
203
+ </el-dropdown-item>
204
+ <el-dropdown-item
205
+ @click="editor.chain().focus().addRowBefore().run()"
206
+ >
207
+ Add row before
208
+ </el-dropdown-item>
209
+ <el-dropdown-item
210
+ @click="editor.chain().focus().addRowAfter().run()"
211
+ >
212
+ Add row after
213
+ </el-dropdown-item>
214
+ <el-dropdown-item
215
+ @click="editor.chain().focus().deleteRow().run()"
216
+ >
217
+ Delete row
218
+ </el-dropdown-item>
219
+ <el-dropdown-item
220
+ @click="editor.chain().focus().deleteTable().run()"
221
+ >
222
+ Delete table
223
+ </el-dropdown-item>
224
+ <el-dropdown-item
225
+ @click="editor.chain().focus().mergeCells().run()"
226
+ >
227
+ Merge cells
228
+ </el-dropdown-item>
229
+ <el-dropdown-item
230
+ @click="editor.chain().focus().splitCell().run()"
231
+ >
232
+ Split cell
233
+ </el-dropdown-item>
234
+ <el-dropdown-item
235
+ @click="
236
+ editor
237
+ .chain()
238
+ .focus()
239
+ .toggleHeaderColumn()
240
+ .run()
241
+ "
242
+ >
243
+ Toggle header column
244
+ </el-dropdown-item>
245
+ <el-dropdown-item
246
+ @click="
247
+ editor.chain().focus().toggleHeaderRow().run()
248
+ "
249
+ >
250
+ Toggle header row
251
+ </el-dropdown-item>
252
+ <el-dropdown-item
253
+ @click="
254
+ editor.chain().focus().toggleHeaderCell().run()
255
+ "
256
+ >
257
+ Toggle header cell
258
+ </el-dropdown-item>
259
+ <el-dropdown-item
260
+ @click="editor.chain().focus().mergeOrSplit().run()"
261
+ >
262
+ Merge or split
263
+ </el-dropdown-item>
264
+ <el-dropdown-item
265
+ @click="
266
+ editor
267
+ .chain()
268
+ .focus()
269
+ .setCellAttribute('colspan', 2)
270
+ .run()
271
+ "
272
+ >
273
+ Set cell attribute
274
+ </el-dropdown-item>
275
+ <el-dropdown-item
276
+ @click="editor.chain().focus().fixTables().run()"
277
+ >
278
+ Fix tables
279
+ </el-dropdown-item>
280
+ </el-dropdown-menu>
281
+ </template>
282
+ </el-dropdown>
283
+ <button
284
+ type="button"
285
+ @click="editor.chain().focus().toggleBulletList().run()"
286
+ :class="{ 'is-active': editor.isActive('bulletList') }"
287
+ >
288
+ <svg viewBox="0 0 18 18">
289
+ <line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"></line>
290
+ <line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"></line>
291
+ <line
292
+ class="ql-stroke"
293
+ x1="6"
294
+ x2="15"
295
+ y1="14"
296
+ y2="14"
297
+ ></line>
298
+ <line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"></line>
299
+ <line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"></line>
300
+ <line
301
+ class="ql-stroke"
302
+ x1="3"
303
+ x2="3"
304
+ y1="14"
305
+ y2="14"
306
+ ></line>
307
+ </svg>
308
+ </button>
309
+ <button
310
+ type="button"
311
+ @click="editor.chain().focus().toggleOrderedList().run()"
312
+ :class="{ 'is-active': editor.isActive('orderedList') }"
313
+ >
314
+ <svg viewBox="0 0 18 18">
315
+ <line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"></line>
316
+ <line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"></line>
317
+ <line
318
+ class="ql-stroke"
319
+ x1="7"
320
+ x2="15"
321
+ y1="14"
322
+ y2="14"
323
+ ></line>
324
+ <line
325
+ class="ql-stroke ql-thin"
326
+ x1="2.5"
327
+ x2="4.5"
328
+ y1="5.5"
329
+ y2="5.5"
330
+ ></line>
331
+ <path
332
+ class="ql-fill"
333
+ d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"
334
+ ></path>
335
+ <path
336
+ class="ql-stroke ql-thin"
337
+ d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"
338
+ ></path>
339
+ <path
340
+ class="ql-stroke ql-thin"
341
+ d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"
342
+ ></path>
343
+ </svg>
344
+ </button>
345
+ <button
346
+ type="button"
347
+ @click="editor.chain().focus().toggleCodeBlock().run()"
348
+ :class="{ 'is-active': editor.isActive('codeBlock') }"
349
+ >
350
+ Code block
351
+ </button>
352
+ <button
353
+ type="button"
354
+ @click="editor.chain().focus().toggleBlockquote().run()"
355
+ :class="{ 'is-active': editor.isActive('blockquote') }"
356
+ >
357
+ Blockquote
358
+ </button>
359
+ <button
360
+ type="button"
361
+ @click="editor.chain().focus().setHorizontalRule().run()"
362
+ >
363
+ Horizontal rule
364
+ </button>
365
+ <button
366
+ type="button"
367
+ @click="editor.chain().focus().toggleSuperscript().run()"
368
+ :class="{ 'is-active': editor.isActive('superscript') }"
369
+ >
370
+ <svg viewBox="0 0 18 18">
371
+ <path
372
+ class="ql-fill"
373
+ d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"
374
+ ></path>
375
+ <path
376
+ class="ql-fill"
377
+ d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"
378
+ ></path>
379
+ </svg>
380
+ </button>
381
+ <button
382
+ type="button"
383
+ @click="editor.chain().focus().toggleSubscript().run()"
384
+ :class="{ 'is-active': editor.isActive('subscript') }"
385
+ >
386
+ <svg viewBox="0 0 18 18">
387
+ <path
388
+ class="ql-fill"
389
+ d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"
390
+ ></path>
391
+ <path
392
+ class="ql-fill"
393
+ d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"
394
+ ></path>
395
+ </svg>
396
+ </button>
397
+ <button
398
+ type="button"
399
+ @click="setLink"
400
+ :class="{ 'is-active': editor.isActive('link') }"
401
+ >
402
+ <svg viewBox="0 0 18 18">
403
+ <line
404
+ class="ql-stroke"
405
+ x1="7"
406
+ x2="11"
407
+ y1="7"
408
+ y2="11"
409
+ ></line>
410
+ <path
411
+ class="ql-even ql-stroke"
412
+ d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"
413
+ ></path>
414
+ <path
415
+ class="ql-even ql-stroke"
416
+ d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"
417
+ ></path>
418
+ </svg>
419
+ </button>
420
+ </div>
421
+ <editor-content :editor="editor" />
422
+ <el-dialog v-model="dialogVisible" title="URL" width="500">
423
+ <label>Enter URL</label>
424
+ <el-input v-model="newUrl" type="url" />
425
+ <template #footer>
426
+ <div class="dialog-footer">
427
+ <el-button @click="dialogVisible = false">Cancel</el-button>
428
+ <el-button type="primary" @click="updateURL">
429
+ Confirm
430
+ </el-button>
431
+ </div>
432
+ </template>
433
+ </el-dialog>
434
+ </XInput>
435
+ </template>
436
+
437
+ <script>
438
+ import input from "./input.js";
439
+ import XInput from "./input.vue";
440
+ import sanitizeHtml from "sanitize-html";
441
+ import {
442
+ ElDropdown,
443
+ ElDropdownItem,
444
+ ElDropdownMenu,
445
+ ElDialog,
446
+ ElButton,
447
+ ElInput,
448
+ } from "element-plus";
449
+ import { Editor, EditorContent } from "@tiptap/vue-3";
450
+ import StarterKit from "@tiptap/starter-kit";
451
+ import Underline from "@tiptap/extension-underline";
452
+ import Table from "@tiptap/extension-table";
453
+ import TableCell from "@tiptap/extension-table-cell";
454
+ import TableHeader from "@tiptap/extension-table-header";
455
+ import TableRow from "@tiptap/extension-table-row";
456
+ import Superscript from "@tiptap/extension-superscript";
457
+ import Subscript from "@tiptap/extension-subscript";
458
+ import Link from "@tiptap/extension-link";
459
+
460
+ export default {
461
+ mixins: [input],
462
+
463
+ components: {
464
+ XInput,
465
+ EditorContent,
466
+ ElDropdown,
467
+ ElDropdownItem,
468
+ ElDropdownMenu,
469
+ ElDialog,
470
+ ElButton,
471
+ ElInput,
472
+ },
473
+
474
+ props: {
475
+ table: {
476
+ type: Boolean,
477
+ default: false,
478
+ },
479
+ baseClass: {
480
+ type: String,
481
+ default: "vel-wysiwyg",
482
+ },
483
+ },
484
+
485
+ data: () => ({
486
+ editor: null,
487
+ hold: null,
488
+ previousUrl: null,
489
+ newUrl: null,
490
+ dialogVisible: false,
491
+ }),
492
+
493
+ watch: {
494
+ modelValue: {
495
+ handler(val) {
496
+ if (this.hold !== val) {
497
+ this.setValue();
498
+ }
499
+ },
500
+ },
501
+ },
502
+
503
+ methods: {
504
+ setValue() {
505
+ this.editor.commands.setContent(this.modelValue);
506
+ },
507
+ setLink() {
508
+ this.previousUrl = this.editor.getAttributes("link").href;
509
+ this.newUrl = this.previousUrl;
510
+ this.dialogVisible = true;
511
+ },
512
+ updateURL() {
513
+ // cancelled
514
+ this.dialogVisible = false;
515
+ let url = this.newUrl;
516
+ if (url === this.previousUrl) {
517
+ return;
518
+ }
519
+
520
+ // empty
521
+ if (url === "") {
522
+ this.editor
523
+ .chain()
524
+ .focus()
525
+ .extendMarkRange("link")
526
+ .unsetLink()
527
+ .run();
528
+
529
+ return;
530
+ }
531
+ // update link
532
+ this.editor
533
+ .chain()
534
+ .focus()
535
+ .extendMarkRange("link")
536
+ .setLink({ href: url })
537
+ .run();
538
+ },
539
+ },
540
+
541
+ mounted() {
542
+ let extensions = [
543
+ StarterKit,
544
+ Underline,
545
+ Superscript,
546
+ Subscript,
547
+ Link.configure({
548
+ openOnClick: false,
549
+ defaultProtocol: "https",
550
+ }),
551
+ ];
552
+ if (this.$props.table) {
553
+ extensions.push(
554
+ Table.configure({
555
+ resizable: true,
556
+ }),
557
+ TableRow,
558
+ TableHeader,
559
+ TableCell,
560
+ );
561
+ }
562
+
563
+ this.editor = new Editor({
564
+ extensions: extensions,
565
+ });
566
+ this.setValue();
567
+
568
+ this.editor.on("blur", ({ editor, event }) => {
569
+ const value = editor.isEmpty ? "" : event.srcElement.innerHTML;
570
+ if (this.hold !== value) {
571
+ this.hold = value;
572
+ this.$emit("update:modelValue", this.hold);
573
+ }
574
+ });
575
+ },
576
+ };
577
+ </script>