@cgboiler/biz-basic 1.0.50 → 1.0.52

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.49";
8
+ export const version: "1.0.51";
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.49";
2
+ const version = "1.0.51";
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
@@ -95,7 +95,8 @@ var stdin_default = defineComponent({
95
95
  type: "hashTag",
96
96
  attrs: {
97
97
  id: data.hashTagId,
98
- label: data.name
98
+ label: data.name,
99
+ type: data.type
99
100
  }
100
101
  });
101
102
  };
@@ -172,11 +173,13 @@ var stdin_default = defineComponent({
172
173
  if (tagEl) {
173
174
  const id = tagEl.getAttribute("data-id") || "";
174
175
  const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
175
- const hashTag = tagEl.getAttribute("data-hash-tag") || "#";
176
+ const trigger = tagEl.getAttribute("data-hash-tag") || "#";
177
+ const tagType = tagEl.getAttribute("data-tag-type") || "";
176
178
  emit("hashTag-clicked", {
177
179
  hashTagId: id,
178
180
  name: label,
179
- type: hashTag
181
+ trigger,
182
+ type: tagType
180
183
  });
181
184
  event.stopPropagation();
182
185
  event.preventDefault();
@@ -218,6 +221,26 @@ var stdin_default = defineComponent({
218
221
  return;
219
222
  }
220
223
  };
224
+ const customContentHoverHandler = (event) => {
225
+ const target = event.target;
226
+ const tagEl = target.closest(".custom-content") || null;
227
+ if (tagEl) {
228
+ const objStr = tagEl.getAttribute("obj") || "{}";
229
+ const label = tagEl.getAttribute("file-label") || "";
230
+ try {
231
+ const obj = JSON.parse(objStr);
232
+ emit("customContent-hovered", {
233
+ obj,
234
+ label
235
+ });
236
+ } catch (e) {
237
+ console.error("Failed to parse custom content obj:", e);
238
+ }
239
+ event.stopPropagation();
240
+ event.preventDefault();
241
+ return;
242
+ }
243
+ };
221
244
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
222
245
  const MAX_HISTORY_ITEMS = 10;
223
246
  let saveTimeoutId = null;
@@ -272,6 +295,7 @@ var stdin_default = defineComponent({
272
295
  editorElement.addEventListener("click", hashTagClickHandler);
273
296
  editorElement.addEventListener("click", mentionClickHandler);
274
297
  editorElement.addEventListener("click", customContentClickHandler);
298
+ editorElement.addEventListener("mouseover", customContentHoverHandler);
275
299
  }
276
300
  });
277
301
  });
@@ -286,6 +310,7 @@ var stdin_default = defineComponent({
286
310
  editorElement.removeEventListener("click", hashTagClickHandler);
287
311
  editorElement.removeEventListener("click", mentionClickHandler);
288
312
  editorElement.removeEventListener("click", customContentClickHandler);
313
+ editorElement.removeEventListener("mouseover", customContentHoverHandler);
289
314
  }
290
315
  (_c = editor.value) == null ? void 0 : _c.destroy();
291
316
  });
@@ -25,6 +25,7 @@ export interface MentionData {
25
25
  export interface HashTagData {
26
26
  hashTagId: string;
27
27
  name: string;
28
+ type?: string;
28
29
  }
29
30
  /**
30
31
  * CustomContentData
@@ -59,10 +59,42 @@ function useExtensions({ props, emit }) {
59
59
  parseHTML() {
60
60
  return [{ tag: 'span[data-type="hashTag"]' }];
61
61
  },
62
+ addAttributes() {
63
+ return {
64
+ id: {
65
+ default: null,
66
+ parseHTML: (element) => element.getAttribute("data-id"),
67
+ renderHTML: (attributes) => {
68
+ if (!attributes.id)
69
+ return {};
70
+ return { "data-id": attributes.id };
71
+ }
72
+ },
73
+ label: {
74
+ default: null,
75
+ parseHTML: (element) => element.getAttribute("data-label"),
76
+ renderHTML: (attributes) => {
77
+ if (!attributes.label)
78
+ return {};
79
+ return { "data-label": attributes.label };
80
+ }
81
+ },
82
+ type: {
83
+ default: null,
84
+ parseHTML: (element) => element.getAttribute("data-tag-type"),
85
+ renderHTML: (attributes) => {
86
+ if (!attributes.type)
87
+ return {};
88
+ return { "data-tag-type": attributes.type };
89
+ }
90
+ }
91
+ };
92
+ },
62
93
  renderHTML({ node }) {
63
- var _a, _b, _c, _d;
94
+ var _a, _b, _c, _d, _e, _f;
64
95
  const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
65
96
  const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
97
+ const type = (_f = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.type) != null ? _f : "";
66
98
  return [
67
99
  "span",
68
100
  {
@@ -70,6 +102,7 @@ function useExtensions({ props, emit }) {
70
102
  "data-type": "hashTag",
71
103
  "data-id": id,
72
104
  "data-label": label,
105
+ "data-tag-type": type,
73
106
  "data-hash-tag": "#",
74
107
  contenteditable: "false"
75
108
  },
@@ -102,10 +135,10 @@ function useExtensions({ props, emit }) {
102
135
  try {
103
136
  (activeEditor || editor).chain().focus().deleteRange(activeRange || range).insertContentAt((activeRange || range).from, {
104
137
  type: "hashTag",
105
- attrs: { id: data.hashTagId, label: data.name }
138
+ attrs: { id: data.hashTagId, label: data.name, type: data.type }
106
139
  }).setTextSelection((activeRange || range).from + 1).insertContent(" ").run();
107
140
  } catch (e) {
108
- command({ id: data.hashTagId, label: data.name });
141
+ command({ id: data.hashTagId, label: data.name, type: data.type });
109
142
  (activeEditor || editor).chain().focus().insertContent(" ").run();
110
143
  }
111
144
  });
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.49";
8
+ export const version: "1.0.51";
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.49";
39
+ const version = "1.0.51";
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
@@ -127,7 +127,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
127
127
  type: "hashTag",
128
128
  attrs: {
129
129
  id: data.hashTagId,
130
- label: data.name
130
+ label: data.name,
131
+ type: data.type
131
132
  }
132
133
  });
133
134
  };
@@ -204,11 +205,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
204
205
  if (tagEl) {
205
206
  const id = tagEl.getAttribute("data-id") || "";
206
207
  const label = tagEl.getAttribute("data-label") || tagEl.textContent || "";
207
- const hashTag = tagEl.getAttribute("data-hash-tag") || "#";
208
+ const trigger = tagEl.getAttribute("data-hash-tag") || "#";
209
+ const tagType = tagEl.getAttribute("data-tag-type") || "";
208
210
  emit("hashTag-clicked", {
209
211
  hashTagId: id,
210
212
  name: label,
211
- type: hashTag
213
+ trigger,
214
+ type: tagType
212
215
  });
213
216
  event.stopPropagation();
214
217
  event.preventDefault();
@@ -250,6 +253,26 @@ var stdin_default = (0, import_vue2.defineComponent)({
250
253
  return;
251
254
  }
252
255
  };
256
+ const customContentHoverHandler = (event) => {
257
+ const target = event.target;
258
+ const tagEl = target.closest(".custom-content") || null;
259
+ if (tagEl) {
260
+ const objStr = tagEl.getAttribute("obj") || "{}";
261
+ const label = tagEl.getAttribute("file-label") || "";
262
+ try {
263
+ const obj = JSON.parse(objStr);
264
+ emit("customContent-hovered", {
265
+ obj,
266
+ label
267
+ });
268
+ } catch (e) {
269
+ console.error("Failed to parse custom content obj:", e);
270
+ }
271
+ event.stopPropagation();
272
+ event.preventDefault();
273
+ return;
274
+ }
275
+ };
253
276
  const HISTORY_METADATA_KEY = "rich_text_editor_history_metadata";
254
277
  const MAX_HISTORY_ITEMS = 10;
255
278
  let saveTimeoutId = null;
@@ -304,6 +327,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
304
327
  editorElement.addEventListener("click", hashTagClickHandler);
305
328
  editorElement.addEventListener("click", mentionClickHandler);
306
329
  editorElement.addEventListener("click", customContentClickHandler);
330
+ editorElement.addEventListener("mouseover", customContentHoverHandler);
307
331
  }
308
332
  });
309
333
  });
@@ -318,6 +342,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
318
342
  editorElement.removeEventListener("click", hashTagClickHandler);
319
343
  editorElement.removeEventListener("click", mentionClickHandler);
320
344
  editorElement.removeEventListener("click", customContentClickHandler);
345
+ editorElement.removeEventListener("mouseover", customContentHoverHandler);
321
346
  }
322
347
  (_c = editor.value) == null ? void 0 : _c.destroy();
323
348
  });
@@ -25,6 +25,7 @@ export interface MentionData {
25
25
  export interface HashTagData {
26
26
  hashTagId: string;
27
27
  name: string;
28
+ type?: string;
28
29
  }
29
30
  /**
30
31
  * CustomContentData
@@ -91,10 +91,42 @@ function useExtensions({ props, emit }) {
91
91
  parseHTML() {
92
92
  return [{ tag: 'span[data-type="hashTag"]' }];
93
93
  },
94
+ addAttributes() {
95
+ return {
96
+ id: {
97
+ default: null,
98
+ parseHTML: (element) => element.getAttribute("data-id"),
99
+ renderHTML: (attributes) => {
100
+ if (!attributes.id)
101
+ return {};
102
+ return { "data-id": attributes.id };
103
+ }
104
+ },
105
+ label: {
106
+ default: null,
107
+ parseHTML: (element) => element.getAttribute("data-label"),
108
+ renderHTML: (attributes) => {
109
+ if (!attributes.label)
110
+ return {};
111
+ return { "data-label": attributes.label };
112
+ }
113
+ },
114
+ type: {
115
+ default: null,
116
+ parseHTML: (element) => element.getAttribute("data-tag-type"),
117
+ renderHTML: (attributes) => {
118
+ if (!attributes.type)
119
+ return {};
120
+ return { "data-tag-type": attributes.type };
121
+ }
122
+ }
123
+ };
124
+ },
94
125
  renderHTML({ node }) {
95
- var _a, _b, _c, _d;
126
+ var _a, _b, _c, _d, _e, _f;
96
127
  const id = (_b = (_a = node == null ? void 0 : node.attrs) == null ? void 0 : _a.id) != null ? _b : "";
97
128
  const label = (_d = (_c = node == null ? void 0 : node.attrs) == null ? void 0 : _c.label) != null ? _d : "";
129
+ const type = (_f = (_e = node == null ? void 0 : node.attrs) == null ? void 0 : _e.type) != null ? _f : "";
98
130
  return [
99
131
  "span",
100
132
  {
@@ -102,6 +134,7 @@ function useExtensions({ props, emit }) {
102
134
  "data-type": "hashTag",
103
135
  "data-id": id,
104
136
  "data-label": label,
137
+ "data-tag-type": type,
105
138
  "data-hash-tag": "#",
106
139
  contenteditable: "false"
107
140
  },
@@ -134,10 +167,10 @@ function useExtensions({ props, emit }) {
134
167
  try {
135
168
  (activeEditor || editor).chain().focus().deleteRange(activeRange || range).insertContentAt((activeRange || range).from, {
136
169
  type: "hashTag",
137
- attrs: { id: data.hashTagId, label: data.name }
170
+ attrs: { id: data.hashTagId, label: data.name, type: data.type }
138
171
  }).setTextSelection((activeRange || range).from + 1).insertContent(" ").run();
139
172
  } catch (e) {
140
- command({ id: data.hashTagId, label: data.name });
173
+ command({ id: data.hashTagId, label: data.name, type: data.type });
141
174
  (activeEditor || editor).chain().focus().insertContent(" ").run();
142
175
  }
143
176
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-basic",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",