@cgboiler/biz-basic 1.0.49 → 1.0.51

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.
package/es/index.d.ts CHANGED
@@ -5,6 +5,6 @@ declare namespace _default {
5
5
  }
6
6
  export default _default;
7
7
  export function install(app: any): void;
8
- export const version: "1.0.48";
8
+ export const version: "1.0.50";
9
9
  import RichTextEditor from './rich-text-editor';
10
10
  export { RichTextEditor };
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import RichTextEditor from "./rich-text-editor";
2
- const version = "1.0.48";
2
+ const version = "1.0.50";
3
3
  function install(app) {
4
4
  const components = [
5
5
  RichTextEditor
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
- }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
20
  modelValue: {
21
21
  type: StringConstructor;
22
22
  default: string;
@@ -48,6 +48,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
48
48
  "onCustomContent-input"?: ((...args: any[]) => any) | undefined;
49
49
  "onCustomContent-exit"?: ((...args: any[]) => any) | undefined;
50
50
  "onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
51
+ "onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
51
52
  }>, {
52
53
  modelValue: string;
53
54
  placeholder: string;
@@ -31,7 +31,7 @@ import "./index.css";
31
31
  var stdin_default = defineComponent({
32
32
  name: "RichTextEditor",
33
33
  props: richTextEditorProps,
34
- emits: ["update:modelValue", "mention-triggered", "mention-input", "mention-exit", "mention-clicked", "hashTag-triggered", "hashTag-input", "hashTag-exit", "hashTag-clicked", "customContent-triggered", "customContent-input", "customContent-exit", "customContent-clicked", "blur", "focus"],
34
+ emits: ["update:modelValue", "mention-triggered", "mention-input", "mention-exit", "mention-clicked", "hashTag-triggered", "hashTag-input", "hashTag-exit", "hashTag-clicked", "customContent-triggered", "customContent-input", "customContent-exit", "customContent-clicked", "customContent-hovered", "blur", "focus"],
35
35
  setup(props, {
36
36
  emit,
37
37
  expose
@@ -218,6 +218,26 @@ var stdin_default = defineComponent({
218
218
  return;
219
219
  }
220
220
  };
221
+ const customContentHoverHandler = (event) => {
222
+ const target = event.target;
223
+ const tagEl = target.closest(".custom-content") || null;
224
+ if (tagEl) {
225
+ const objStr = tagEl.getAttribute("obj") || "{}";
226
+ const label = tagEl.getAttribute("file-label") || "";
227
+ try {
228
+ const obj = JSON.parse(objStr);
229
+ emit("customContent-hovered", {
230
+ obj,
231
+ label
232
+ });
233
+ } catch (e) {
234
+ console.error("Failed to parse custom content obj:", e);
235
+ }
236
+ event.stopPropagation();
237
+ event.preventDefault();
238
+ return;
239
+ }
240
+ };
221
241
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
222
242
  const MAX_HISTORY_ITEMS = 10;
223
243
  let saveTimeoutId = null;
@@ -272,6 +292,7 @@ var stdin_default = defineComponent({
272
292
  editorElement.addEventListener("click", hashTagClickHandler);
273
293
  editorElement.addEventListener("click", mentionClickHandler);
274
294
  editorElement.addEventListener("click", customContentClickHandler);
295
+ editorElement.addEventListener("mouseover", customContentHoverHandler);
275
296
  }
276
297
  });
277
298
  });
@@ -286,6 +307,7 @@ var stdin_default = defineComponent({
286
307
  editorElement.removeEventListener("click", hashTagClickHandler);
287
308
  editorElement.removeEventListener("click", mentionClickHandler);
288
309
  editorElement.removeEventListener("click", customContentClickHandler);
310
+ editorElement.removeEventListener("mouseover", customContentHoverHandler);
289
311
  }
290
312
  (_c = editor.value) == null ? void 0 : _c.destroy();
291
313
  });
@@ -56,6 +56,9 @@ function useExtensions({ props, emit }) {
56
56
  };
57
57
  const HashTag = Mention.extend({
58
58
  name: "hashTag",
59
+ parseHTML() {
60
+ return [{ tag: 'span[data-type="hashTag"]' }];
61
+ },
59
62
  renderHTML({ node }) {
60
63
  var _a, _b, _c, _d;
61
64
  const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
@@ -146,6 +149,9 @@ function useExtensions({ props, emit }) {
146
149
  });
147
150
  const CustomContent = Mention.extend({
148
151
  name: "customContent",
152
+ parseHTML() {
153
+ return [{ tag: 'span[data-type="custom-content"]' }];
154
+ },
149
155
  addAttributes() {
150
156
  return {
151
157
  id: {
@@ -176,7 +182,11 @@ function useExtensions({ props, emit }) {
176
182
  default: null,
177
183
  parseHTML: (element) => {
178
184
  const objStr = element.getAttribute("obj");
179
- return objStr ? JSON.parse(objStr) : null;
185
+ try {
186
+ return objStr ? JSON.parse(objStr) : null;
187
+ } catch (e) {
188
+ return null;
189
+ }
180
190
  },
181
191
  renderHTML: (attributes) => {
182
192
  if (!attributes.obj) {
package/lib/index.d.ts CHANGED
@@ -5,6 +5,6 @@ declare namespace _default {
5
5
  }
6
6
  export default _default;
7
7
  export function install(app: any): void;
8
- export const version: "1.0.48";
8
+ export const version: "1.0.50";
9
9
  import RichTextEditor from './rich-text-editor';
10
10
  export { RichTextEditor };
package/lib/index.js CHANGED
@@ -36,7 +36,7 @@ __export(stdin_exports, {
36
36
  module.exports = __toCommonJS(stdin_exports);
37
37
  var import_rich_text_editor = __toESM(require("./rich-text-editor"));
38
38
  __reExport(stdin_exports, require("./rich-text-editor"), module.exports);
39
- const version = "1.0.48";
39
+ const version = "1.0.50";
40
40
  function install(app) {
41
41
  const components = [
42
42
  import_rich_text_editor.default
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
- }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered")[], "blur" | "focus" | "hashTag-triggered" | "hashTag-input" | "hashTag-exit" | "mention-triggered" | "mention-input" | "mention-exit" | "update:modelValue" | "mention-clicked" | "hashTag-clicked" | "customContent-triggered" | "customContent-input" | "customContent-exit" | "customContent-clicked" | "customContent-hovered", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
20
  modelValue: {
21
21
  type: StringConstructor;
22
22
  default: string;
@@ -48,6 +48,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
48
48
  "onCustomContent-input"?: ((...args: any[]) => any) | undefined;
49
49
  "onCustomContent-exit"?: ((...args: any[]) => any) | undefined;
50
50
  "onCustomContent-clicked"?: ((...args: any[]) => any) | undefined;
51
+ "onCustomContent-hovered"?: ((...args: any[]) => any) | undefined;
51
52
  }>, {
52
53
  modelValue: string;
53
54
  placeholder: string;
@@ -63,7 +63,7 @@ var import_index = require("./index.css");
63
63
  var stdin_default = (0, import_vue2.defineComponent)({
64
64
  name: "RichTextEditor",
65
65
  props: import_types.richTextEditorProps,
66
- emits: ["update:modelValue", "mention-triggered", "mention-input", "mention-exit", "mention-clicked", "hashTag-triggered", "hashTag-input", "hashTag-exit", "hashTag-clicked", "customContent-triggered", "customContent-input", "customContent-exit", "customContent-clicked", "blur", "focus"],
66
+ emits: ["update:modelValue", "mention-triggered", "mention-input", "mention-exit", "mention-clicked", "hashTag-triggered", "hashTag-input", "hashTag-exit", "hashTag-clicked", "customContent-triggered", "customContent-input", "customContent-exit", "customContent-clicked", "customContent-hovered", "blur", "focus"],
67
67
  setup(props, {
68
68
  emit,
69
69
  expose
@@ -250,6 +250,26 @@ var stdin_default = (0, import_vue2.defineComponent)({
250
250
  return;
251
251
  }
252
252
  };
253
+ const customContentHoverHandler = (event) => {
254
+ const target = event.target;
255
+ const tagEl = target.closest(".custom-content") || null;
256
+ if (tagEl) {
257
+ const objStr = tagEl.getAttribute("obj") || "{}";
258
+ const label = tagEl.getAttribute("file-label") || "";
259
+ try {
260
+ const obj = JSON.parse(objStr);
261
+ emit("customContent-hovered", {
262
+ obj,
263
+ label
264
+ });
265
+ } catch (e) {
266
+ console.error("Failed to parse custom content obj:", e);
267
+ }
268
+ event.stopPropagation();
269
+ event.preventDefault();
270
+ return;
271
+ }
272
+ };
253
273
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
254
274
  const MAX_HISTORY_ITEMS = 10;
255
275
  let saveTimeoutId = null;
@@ -304,6 +324,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
304
324
  editorElement.addEventListener("click", hashTagClickHandler);
305
325
  editorElement.addEventListener("click", mentionClickHandler);
306
326
  editorElement.addEventListener("click", customContentClickHandler);
327
+ editorElement.addEventListener("mouseover", customContentHoverHandler);
307
328
  }
308
329
  });
309
330
  });
@@ -318,6 +339,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
318
339
  editorElement.removeEventListener("click", hashTagClickHandler);
319
340
  editorElement.removeEventListener("click", mentionClickHandler);
320
341
  editorElement.removeEventListener("click", customContentClickHandler);
342
+ editorElement.removeEventListener("mouseover", customContentHoverHandler);
321
343
  }
322
344
  (_c = editor.value) == null ? void 0 : _c.destroy();
323
345
  });
@@ -88,6 +88,9 @@ function useExtensions({ props, emit }) {
88
88
  };
89
89
  const HashTag = import_extension_mention.default.extend({
90
90
  name: "hashTag",
91
+ parseHTML() {
92
+ return [{ tag: 'span[data-type="hashTag"]' }];
93
+ },
91
94
  renderHTML({ node }) {
92
95
  var _a, _b, _c, _d;
93
96
  const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
@@ -178,6 +181,9 @@ function useExtensions({ props, emit }) {
178
181
  });
179
182
  const CustomContent = import_extension_mention.default.extend({
180
183
  name: "customContent",
184
+ parseHTML() {
185
+ return [{ tag: 'span[data-type="custom-content"]' }];
186
+ },
181
187
  addAttributes() {
182
188
  return {
183
189
  id: {
@@ -208,7 +214,11 @@ function useExtensions({ props, emit }) {
208
214
  default: null,
209
215
  parseHTML: (element) => {
210
216
  const objStr = element.getAttribute("obj");
211
- return objStr ? JSON.parse(objStr) : null;
217
+ try {
218
+ return objStr ? JSON.parse(objStr) : null;
219
+ } catch (e) {
220
+ return null;
221
+ }
212
222
  },
213
223
  renderHTML: (attributes) => {
214
224
  if (!attributes.obj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-basic",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",