@tailor-cms/ce-html-edit 0.1.1 → 0.1.3

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.
@@ -0,0 +1,5 @@
1
+ type __VLS_Props = {
2
+ editor: any;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: (import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-paragraph").ParagraphOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-subscript").SubscriptExtensionOptions, any>)[];
1
+ declare const _default: (import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Node<import("@tiptap/extension-paragraph").ParagraphOptions, any>)[];
2
2
  export default _default;
@@ -0,0 +1,14 @@
1
+ import { Mark } from '@tiptap/vue-3';
2
+ declare module '@tiptap/vue-3' {
3
+ interface Commands<ReturnType> {
4
+ tooltip: {
5
+ setTooltip: (attributes: {
6
+ tooltip: string;
7
+ text: string;
8
+ }) => ReturnType;
9
+ unsetTooltip: () => ReturnType;
10
+ };
11
+ }
12
+ }
13
+ declare const _default: Mark<any, any>;
14
+ export default _default;
package/dist/index.cjs CHANGED
@@ -26168,11 +26168,10 @@ const Link = Link$1.extend({
26168
26168
  addCommands() {
26169
26169
  return {
26170
26170
  ...this.parent?.(),
26171
- setLinkText: ({ attributes, text } = {}) => ({ chain }) => {
26172
- return chain().setMark(this.name, { href: attributes?.href }).command(({ tr: tr2 }) => {
26173
- tr2.insertText(text);
26174
- return true;
26175
- }).setMeta("preventAutolink", true).run();
26171
+ setLinkText: ({ href, text } = { href: "", text: "" }) => ({ chain, state }) => {
26172
+ const { from: from2 } = state.selection;
26173
+ const to = from2 + text.length;
26174
+ return chain().insertContent(text).setTextSelection({ from: from2, to }).setMark(this.name, { href }).setMeta("preventAutolink", true).run();
26176
26175
  }
26177
26176
  };
26178
26177
  }
@@ -26198,12 +26197,51 @@ const Paragraph = Paragraph$1.extend({
26198
26197
  ];
26199
26198
  }
26200
26199
  });
26200
+ const Tooltip = Mark2.create({
26201
+ name: "tooltip",
26202
+ keepOnSplit: false,
26203
+ exitable: true,
26204
+ addAttributes() {
26205
+ return {
26206
+ "data-tooltip": {
26207
+ default: null,
26208
+ parseHTML: (element) => element.getAttribute("data-tooltip"),
26209
+ renderHTML: (attributes) => ({
26210
+ "data-tooltip": attributes["data-tooltip"]
26211
+ })
26212
+ }
26213
+ };
26214
+ },
26215
+ parseHTML() {
26216
+ return [{ tag: "span[data-tooltip]" }];
26217
+ },
26218
+ renderHTML({ HTMLAttributes }) {
26219
+ return [
26220
+ "span",
26221
+ mergeAttributes({ class: "has-tooltip" }, HTMLAttributes),
26222
+ 0
26223
+ ];
26224
+ },
26225
+ addCommands() {
26226
+ return {
26227
+ setTooltip: ({ tooltip, text } = { tooltip: "", text: "" }) => ({ chain, state }) => {
26228
+ const { from: from2 } = state.selection;
26229
+ const to = from2 + text.length;
26230
+ return chain().insertContent(text).setTextSelection({ from: from2, to }).setMark(this.name, { "data-tooltip": tooltip }).run();
26231
+ },
26232
+ unsetTooltip: () => ({ chain }) => {
26233
+ return chain().unsetMark(this.name).run();
26234
+ }
26235
+ };
26236
+ }
26237
+ });
26201
26238
  const extensions = [
26202
26239
  Color,
26203
26240
  FontFamily$1,
26204
26241
  FontSize$1,
26205
26242
  Image,
26206
26243
  Link.configure({ openOnClick: false }),
26244
+ Tooltip,
26207
26245
  StarterKit.configure({ paragraph: false }),
26208
26246
  Subscript,
26209
26247
  Superscript,
@@ -26223,7 +26261,7 @@ const extensions = [
26223
26261
  placeholder: "Enter your text..."
26224
26262
  })
26225
26263
  ];
26226
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
26264
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
26227
26265
  __name: "IconButton",
26228
26266
  props: {
26229
26267
  active: { type: Boolean },
@@ -26268,8 +26306,8 @@ const _export_sfc = (sfc, props) => {
26268
26306
  }
26269
26307
  return target;
26270
26308
  };
26271
- const IconButton = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-5f000959"]]);
26272
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
26309
+ const IconButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-5f000959"]]);
26310
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
26273
26311
  __name: "ImageMenu",
26274
26312
  props: {
26275
26313
  editor: {}
@@ -26324,8 +26362,8 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
26324
26362
  };
26325
26363
  }
26326
26364
  });
26327
- const ImageMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-cb530515"]]);
26328
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
26365
+ const ImageMenu = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-cb530515"]]);
26366
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
26329
26367
  __name: "TableMenu",
26330
26368
  props: {
26331
26369
  editor: {}
@@ -26424,10 +26462,10 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
26424
26462
  };
26425
26463
  }
26426
26464
  });
26427
- const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-e73020ec"]]);
26428
- const _hoisted_1$3 = { class: "tce-container" };
26465
+ const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e73020ec"]]);
26466
+ const _hoisted_1$4 = { class: "tce-container" };
26429
26467
  const SAVE_DEBOUNCE = 3e3;
26430
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
26468
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
26431
26469
  __name: "Edit",
26432
26470
  props: {
26433
26471
  element: {},
@@ -26471,7 +26509,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
26471
26509
  }
26472
26510
  );
26473
26511
  return (_ctx, _cache) => {
26474
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
26512
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
26475
26513
  vue.unref(editor) ? (vue.openBlock(), vue.createBlock(ImageMenu, {
26476
26514
  key: 0,
26477
26515
  editor: vue.unref(editor)
@@ -26488,7 +26526,7 @@ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
26488
26526
  };
26489
26527
  }
26490
26528
  });
26491
- const Edit = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e677fca4"]]);
26529
+ const Edit = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-c46e1fb5"]]);
26492
26530
  function getDefaultExportFromCjs(x) {
26493
26531
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
26494
26532
  }
@@ -26888,8 +26926,8 @@ function requireIsURL() {
26888
26926
  }
26889
26927
  var isURLExports = /* @__PURE__ */ requireIsURL();
26890
26928
  const isURL = /* @__PURE__ */ getDefaultExportFromCjs(isURLExports);
26891
- const _hoisted_1$2 = { class: "actions d-flex justify-end" };
26892
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
26929
+ const _hoisted_1$3 = { class: "actions d-flex justify-end" };
26930
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
26893
26931
  __name: "AddImage",
26894
26932
  props: {
26895
26933
  editor: {}
@@ -26996,7 +27034,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
26996
27034
  label: "Url",
26997
27035
  variant: "outlined"
26998
27036
  }, null, 8, ["modelValue", "rules"]),
26999
- vue.createElementVNode("div", _hoisted_1$2, [
27037
+ vue.createElementVNode("div", _hoisted_1$3, [
27000
27038
  vue.createVNode(_component_VBtn, {
27001
27039
  color: "primary",
27002
27040
  type: "submit",
@@ -27021,9 +27059,9 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
27021
27059
  };
27022
27060
  }
27023
27061
  });
27024
- const AddImage = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8e6263e8"]]);
27025
- const _hoisted_1$1 = { class: "actions d-flex justify-end" };
27026
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27062
+ const AddImage = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-8e6263e8"]]);
27063
+ const _hoisted_1$2 = { class: "actions d-flex justify-end" };
27064
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
27027
27065
  __name: "AddLink",
27028
27066
  props: {
27029
27067
  editor: {}
@@ -27057,8 +27095,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27057
27095
  if (!valid) return;
27058
27096
  const href = url.value.startsWith("http") ? url.value : `https://${url.value}`;
27059
27097
  if (href) {
27060
- const attributes = { href };
27061
- props.editor.chain().focus().setLinkText({ attributes, text: text.value }).run();
27098
+ props.editor.chain().focus().setLinkText({ href, text: text.value }).run();
27062
27099
  } else props.editor.chain().focus().unsetLink().run();
27063
27100
  show.value = false;
27064
27101
  form.value.resetValidation();
@@ -27095,7 +27132,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27095
27132
  default: vue.withCtx(() => [
27096
27133
  vue.createVNode(_component_VIcon, { size: "24" }, {
27097
27134
  default: vue.withCtx(() => _cache[3] || (_cache[3] = [
27098
- vue.createTextVNode("mdi-link")
27135
+ vue.createTextVNode("mdi-link-variant-plus")
27099
27136
  ])),
27100
27137
  _: 1,
27101
27138
  __: [3]
@@ -27143,11 +27180,12 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27143
27180
  label: "Url",
27144
27181
  variant: "outlined"
27145
27182
  }, null, 8, ["modelValue", "rules"]),
27146
- vue.createElementVNode("div", _hoisted_1$1, [
27183
+ vue.createElementVNode("div", _hoisted_1$2, [
27147
27184
  _ctx.editor.isActive("link") ? (vue.openBlock(), vue.createBlock(_component_VBtn, {
27148
27185
  key: 0,
27149
27186
  class: "mr-2",
27150
- variant: "plain",
27187
+ color: "primary-darken-3",
27188
+ variant: "text",
27151
27189
  onClick: unlink
27152
27190
  }, {
27153
27191
  default: vue.withCtx(() => _cache[5] || (_cache[5] = [
@@ -27157,12 +27195,12 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27157
27195
  __: [5]
27158
27196
  })) : vue.createCommentVNode("", true),
27159
27197
  vue.createVNode(_component_VBtn, {
27160
- color: "primary",
27198
+ color: "primary-darken-3",
27161
27199
  type: "submit",
27162
27200
  variant: "tonal"
27163
27201
  }, {
27164
27202
  default: vue.withCtx(() => _cache[6] || (_cache[6] = [
27165
- vue.createTextVNode("Confirm")
27203
+ vue.createTextVNode(" Confirm ")
27166
27204
  ])),
27167
27205
  _: 1,
27168
27206
  __: [6]
@@ -27180,11 +27218,11 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27180
27218
  };
27181
27219
  }
27182
27220
  });
27183
- const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-148650fc"]]);
27184
- const _hoisted_1 = { class: "text-body-2" };
27221
+ const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-426754d7"]]);
27222
+ const _hoisted_1$1 = { class: "text-body-2" };
27185
27223
  const INIT_SIZE = 5;
27186
27224
  const MAX_SIZE = 10;
27187
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
27225
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27188
27226
  __name: "AddTable",
27189
27227
  props: {
27190
27228
  editor: {}
@@ -27294,7 +27332,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
27294
27332
  }), 128))
27295
27333
  ]);
27296
27334
  }), 128)),
27297
- vue.createElementVNode("span", _hoisted_1, vue.toDisplayString(selectedSize.rows) + "x" + vue.toDisplayString(selectedSize.cols), 1)
27335
+ vue.createElementVNode("span", _hoisted_1$1, vue.toDisplayString(selectedSize.rows) + "x" + vue.toDisplayString(selectedSize.cols), 1)
27298
27336
  ]),
27299
27337
  _: 1
27300
27338
  })
@@ -27304,7 +27342,161 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
27304
27342
  };
27305
27343
  }
27306
27344
  });
27307
- const AddTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-86386e2b"]]);
27345
+ const AddTable = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-86386e2b"]]);
27346
+ const _hoisted_1 = { class: "actions d-flex justify-end" };
27347
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
27348
+ __name: "AddTooltip",
27349
+ props: {
27350
+ editor: {}
27351
+ },
27352
+ setup(__props) {
27353
+ const rules = {
27354
+ required: (val) => !!val || "The field is required"
27355
+ };
27356
+ const props = __props;
27357
+ const form = vue.ref();
27358
+ const getText2 = () => {
27359
+ const { view, state } = props.editor;
27360
+ const { from: from2, to } = view.state.selection;
27361
+ return state.doc.textBetween(from2, to, " ");
27362
+ };
27363
+ const tooltip = vue.ref("");
27364
+ const text = vue.ref("");
27365
+ const show = vue.ref(false);
27366
+ function unset() {
27367
+ props.editor.chain().focus().unsetTooltip().run();
27368
+ tooltip.value = "";
27369
+ show.value = false;
27370
+ }
27371
+ async function setTooltip() {
27372
+ const { valid } = await form.value.validate();
27373
+ if (!valid) return;
27374
+ if (tooltip.value) {
27375
+ const attributes = { tooltip: tooltip.value, text: text.value };
27376
+ console.log("Setting tooltip with attributes:", attributes);
27377
+ props.editor.chain().focus().setTooltip(attributes).run();
27378
+ } else props.editor.chain().focus().unsetTooltip().run();
27379
+ show.value = false;
27380
+ form.value.resetValidation();
27381
+ }
27382
+ vue.watch(show, (val) => {
27383
+ if (!val) return;
27384
+ tooltip.value = props.editor.getAttributes("tooltip")["data-tooltip"] ?? "";
27385
+ text.value = getText2() ?? "";
27386
+ form.value?.resetValidation();
27387
+ });
27388
+ return (_ctx, _cache) => {
27389
+ const _component_VIcon = vue.resolveComponent("VIcon");
27390
+ const _component_VBtn = vue.resolveComponent("VBtn");
27391
+ const _component_VTooltip = vue.resolveComponent("VTooltip");
27392
+ const _component_VTextField = vue.resolveComponent("VTextField");
27393
+ const _component_VSheet = vue.resolveComponent("VSheet");
27394
+ const _component_VForm = vue.resolveComponent("VForm");
27395
+ const _component_VMenu = vue.resolveComponent("VMenu");
27396
+ return vue.openBlock(), vue.createBlock(_component_VMenu, {
27397
+ modelValue: show.value,
27398
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => show.value = $event),
27399
+ "close-on-content-click": false
27400
+ }, {
27401
+ activator: vue.withCtx(({ props: menu }) => [
27402
+ vue.createVNode(_component_VTooltip, { location: "bottom" }, {
27403
+ activator: vue.withCtx(({ props: tooltipProps }) => [
27404
+ vue.createVNode(_component_VBtn, vue.mergeProps({
27405
+ active: _ctx.editor.isActive("tooltip"),
27406
+ disabled: !_ctx.editor.can().chain().focus().setTooltip().run(),
27407
+ "aria-label": "Add tooltip",
27408
+ rounded: "lg",
27409
+ size: "32"
27410
+ }, vue.mergeProps(menu, tooltipProps)), {
27411
+ default: vue.withCtx(() => [
27412
+ vue.createVNode(_component_VIcon, { size: "24" }, {
27413
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
27414
+ vue.createTextVNode("mdi-tooltip-text")
27415
+ ])),
27416
+ _: 1,
27417
+ __: [3]
27418
+ })
27419
+ ]),
27420
+ _: 2
27421
+ }, 1040, ["active", "disabled"])
27422
+ ]),
27423
+ default: vue.withCtx(() => [
27424
+ _cache[4] || (_cache[4] = vue.createTextVNode(" Add tooltip "))
27425
+ ]),
27426
+ _: 2,
27427
+ __: [4]
27428
+ }, 1024)
27429
+ ]),
27430
+ default: vue.withCtx(() => [
27431
+ vue.createVNode(_component_VForm, {
27432
+ ref_key: "form",
27433
+ ref: form,
27434
+ onSubmit: vue.withModifiers(setTooltip, ["prevent"])
27435
+ }, {
27436
+ default: vue.withCtx(() => [
27437
+ vue.createVNode(_component_VSheet, {
27438
+ class: "pa-3",
27439
+ elevation: "8",
27440
+ width: "240",
27441
+ rounded: ""
27442
+ }, {
27443
+ default: vue.withCtx(() => [
27444
+ vue.createVNode(_component_VTextField, {
27445
+ modelValue: text.value,
27446
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
27447
+ rules: [rules.required],
27448
+ density: "compact",
27449
+ "hide-details": "auto",
27450
+ label: "Text",
27451
+ variant: "outlined"
27452
+ }, null, 8, ["modelValue", "rules"]),
27453
+ vue.createVNode(_component_VTextField, {
27454
+ modelValue: tooltip.value,
27455
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tooltip.value = $event),
27456
+ rules: [rules.required],
27457
+ density: "compact",
27458
+ "hide-details": "auto",
27459
+ label: "Tooltip",
27460
+ variant: "outlined"
27461
+ }, null, 8, ["modelValue", "rules"]),
27462
+ vue.createElementVNode("div", _hoisted_1, [
27463
+ _ctx.editor.isActive("tooltip") ? (vue.openBlock(), vue.createBlock(_component_VBtn, {
27464
+ key: 0,
27465
+ class: "mr-2",
27466
+ variant: "plain",
27467
+ onClick: unset
27468
+ }, {
27469
+ default: vue.withCtx(() => _cache[5] || (_cache[5] = [
27470
+ vue.createTextVNode(" Remove ")
27471
+ ])),
27472
+ _: 1,
27473
+ __: [5]
27474
+ })) : vue.createCommentVNode("", true),
27475
+ vue.createVNode(_component_VBtn, {
27476
+ color: "primary",
27477
+ type: "submit",
27478
+ variant: "tonal"
27479
+ }, {
27480
+ default: vue.withCtx(() => _cache[6] || (_cache[6] = [
27481
+ vue.createTextVNode("Confirm")
27482
+ ])),
27483
+ _: 1,
27484
+ __: [6]
27485
+ })
27486
+ ])
27487
+ ]),
27488
+ _: 1
27489
+ })
27490
+ ]),
27491
+ _: 1
27492
+ }, 512)
27493
+ ]),
27494
+ _: 1
27495
+ }, 8, ["modelValue"]);
27496
+ };
27497
+ }
27498
+ });
27499
+ const AddTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9f5b7855"]]);
27308
27500
  const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
27309
27501
  __name: "FontFamily",
27310
27502
  props: {
@@ -27999,6 +28191,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
27999
28191
  { component: AddLink },
28000
28192
  { component: AddTable },
28001
28193
  { component: AddImage },
28194
+ { component: AddTooltip },
28002
28195
  {
28003
28196
  label: "Horizontal line",
28004
28197
  action: ["setHorizontalRule"],
@@ -28112,7 +28305,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
28112
28305
  };
28113
28306
  }
28114
28307
  });
28115
- const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b4ffaa29"]]);
28308
+ const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-62e3d651"]]);
28116
28309
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
28117
28310
  __name: "TopToolbar",
28118
28311
  props: {
package/dist/index.css CHANGED
@@ -11,93 +11,93 @@
11
11
  }
12
12
  [data-v-e73020ec] .v-btn.v-btn--active {
13
13
  color: rgba(var(--v-theme-primary));
14
- }.tce-container[data-v-e677fca4] {
14
+ }.tce-container[data-v-c46e1fb5] {
15
15
  text-align: left;
16
16
  }
17
- [data-v-e677fca4] .ProseMirror {
17
+ [data-v-c46e1fb5] .ProseMirror {
18
18
  min-height: 5rem;
19
19
  padding: 0.5rem;
20
20
  font-family: Arial, Helvetica, sans-serif;
21
21
  font-size: 1rem;
22
22
  outline: none;
23
23
  }
24
- [data-v-e677fca4] .ProseMirror p.is-editor-empty:first-child::before {
24
+ [data-v-c46e1fb5] .ProseMirror p.is-editor-empty:first-child::before {
25
25
  content: attr(data-placeholder);
26
26
  height: 0;
27
27
  opacity: 0.5;
28
28
  float: left;
29
29
  pointer-events: none;
30
30
  }
31
- [data-v-e677fca4] .ProseMirror > * + * {
31
+ [data-v-c46e1fb5] .ProseMirror > * + * {
32
32
  margin-top: 0.75em;
33
33
  }
34
- [data-v-e677fca4] .ProseMirror h1,[data-v-e677fca4] .ProseMirror h2,[data-v-e677fca4] .ProseMirror h3,[data-v-e677fca4] .ProseMirror h4,[data-v-e677fca4] .ProseMirror h5,[data-v-e677fca4] .ProseMirror h6 {
34
+ [data-v-c46e1fb5] .ProseMirror h1,[data-v-c46e1fb5] .ProseMirror h2,[data-v-c46e1fb5] .ProseMirror h3,[data-v-c46e1fb5] .ProseMirror h4,[data-v-c46e1fb5] .ProseMirror h5,[data-v-c46e1fb5] .ProseMirror h6 {
35
35
  line-height: 1.1;
36
36
  }
37
- [data-v-e677fca4] .ProseMirror h1 {
37
+ [data-v-c46e1fb5] .ProseMirror h1 {
38
38
  font-size: 2.5rem;
39
39
  }
40
- [data-v-e677fca4] .ProseMirror h2 {
40
+ [data-v-c46e1fb5] .ProseMirror h2 {
41
41
  font-size: 2.25rem;
42
42
  }
43
- [data-v-e677fca4] .ProseMirror h3 {
43
+ [data-v-c46e1fb5] .ProseMirror h3 {
44
44
  font-size: 2rem;
45
45
  }
46
- [data-v-e677fca4] .ProseMirror h4 {
46
+ [data-v-c46e1fb5] .ProseMirror h4 {
47
47
  font-size: 1.75rem;
48
48
  }
49
- [data-v-e677fca4] .ProseMirror h5 {
49
+ [data-v-c46e1fb5] .ProseMirror h5 {
50
50
  font-size: 1.5rem;
51
51
  }
52
- [data-v-e677fca4] .ProseMirror h6 {
52
+ [data-v-c46e1fb5] .ProseMirror h6 {
53
53
  font-size: 1.25rem;
54
54
  }
55
- [data-v-e677fca4] .ProseMirror blockquote {
55
+ [data-v-c46e1fb5] .ProseMirror blockquote {
56
56
  padding: 0.25rem 1rem;
57
57
  border-left: 2px solid rgba(13, 13, 13, 0.1);
58
58
  font-family: Georgia, "Times New Roman", Times, serif;
59
59
  font-style: italic;
60
60
  }
61
- [data-v-e677fca4] .ProseMirror ul,[data-v-e677fca4] .ProseMirror ol {
61
+ [data-v-c46e1fb5] .ProseMirror ul,[data-v-c46e1fb5] .ProseMirror ol {
62
62
  padding: 0 1.25rem;
63
63
  }
64
- [data-v-e677fca4] .ProseMirror code {
64
+ [data-v-c46e1fb5] .ProseMirror code {
65
65
  font-family: "Source Code Pro", monospace !important;
66
66
  background: #eee;
67
67
  padding: 0.125rem 0.5rem;
68
68
  border-radius: 8px;
69
69
  }
70
- [data-v-e677fca4] .ProseMirror pre {
70
+ [data-v-c46e1fb5] .ProseMirror pre {
71
71
  padding: 0.5rem 1rem;
72
72
  border-radius: 8px;
73
73
  background: #eee;
74
74
  white-space: pre-wrap;
75
75
  }
76
- [data-v-e677fca4] .ProseMirror pre code {
76
+ [data-v-c46e1fb5] .ProseMirror pre code {
77
77
  padding: 0;
78
78
  font-size: 0.875rem;
79
79
  background: none;
80
80
  }
81
- [data-v-e677fca4] .ProseMirror img {
81
+ [data-v-c46e1fb5] .ProseMirror img {
82
82
  max-width: 100%;
83
83
  height: auto;
84
84
  }
85
- [data-v-e677fca4] .ProseMirror img.ProseMirror-selectednode {
85
+ [data-v-c46e1fb5] .ProseMirror img.ProseMirror-selectednode {
86
86
  outline: 2px solid #68cef8;
87
87
  }
88
- [data-v-e677fca4] .ProseMirror hr {
88
+ [data-v-c46e1fb5] .ProseMirror hr {
89
89
  border: none;
90
90
  border-top: 2px solid rgba(13, 13, 13, 0.1);
91
91
  margin: 2rem 0;
92
92
  }
93
- [data-v-e677fca4] .ProseMirror table {
93
+ [data-v-c46e1fb5] .ProseMirror table {
94
94
  border-collapse: collapse;
95
95
  table-layout: fixed;
96
96
  width: 100%;
97
97
  margin: 0;
98
98
  overflow: hidden;
99
99
  }
100
- [data-v-e677fca4] .ProseMirror table td,[data-v-e677fca4] .ProseMirror table th {
100
+ [data-v-c46e1fb5] .ProseMirror table td,[data-v-c46e1fb5] .ProseMirror table th {
101
101
  min-width: 1em;
102
102
  border: 2px solid #ced4da;
103
103
  padding: 3px 5px;
@@ -105,15 +105,15 @@
105
105
  box-sizing: border-box;
106
106
  position: relative;
107
107
  }
108
- [data-v-e677fca4] .ProseMirror table td > *,[data-v-e677fca4] .ProseMirror table th > * {
108
+ [data-v-c46e1fb5] .ProseMirror table td > *,[data-v-c46e1fb5] .ProseMirror table th > * {
109
109
  margin-bottom: 0;
110
110
  }
111
- [data-v-e677fca4] .ProseMirror table th {
111
+ [data-v-c46e1fb5] .ProseMirror table th {
112
112
  font-weight: bold;
113
113
  text-align: left;
114
114
  background-color: #f1f3f5;
115
115
  }
116
- [data-v-e677fca4] .ProseMirror table .selectedCell:after {
116
+ [data-v-c46e1fb5] .ProseMirror table .selectedCell:after {
117
117
  z-index: 2;
118
118
  position: absolute;
119
119
  content: "";
@@ -124,7 +124,7 @@
124
124
  background: rgba(200, 200, 255, 0.4);
125
125
  pointer-events: none;
126
126
  }
127
- [data-v-e677fca4] .ProseMirror table .column-resize-handle {
127
+ [data-v-c46e1fb5] .ProseMirror table .column-resize-handle {
128
128
  position: absolute;
129
129
  right: -2px;
130
130
  top: 0;
@@ -133,13 +133,53 @@
133
133
  background-color: #adf;
134
134
  pointer-events: none;
135
135
  }
136
- [data-v-e677fca4] .ProseMirror table p {
136
+ [data-v-c46e1fb5] .ProseMirror table p {
137
137
  margin: 0;
138
+ }
139
+ [data-v-c46e1fb5] .has-tooltip {
140
+ position: relative;
141
+ display: inline-block;
142
+ background: rgba(205, 215, 220, 0.7);
143
+ text-decoration: underline dashed rgba(33, 33, 33, 0.8);
144
+ cursor: help;
145
+ }
146
+ [data-v-c46e1fb5] .has-tooltip::before {
147
+ content: "";
148
+ position: absolute;
149
+ bottom: 100%;
150
+ border-left: 6px solid transparent;
151
+ border-right: 6px solid transparent;
152
+ border-top: 6px solid rgba(33, 33, 33, 0.8);
153
+ }
154
+ [data-v-c46e1fb5] .has-tooltip::after {
155
+ content: attr(data-tooltip);
156
+ position: absolute;
157
+ bottom: calc(100% + 6px);
158
+ left: -0.625rem;
159
+ border-radius: 4px;
160
+ max-width: 14rem;
161
+ padding: 0.375rem 0.675rem;
162
+ background: rgba(33, 33, 33, 0.8);
163
+ font-size: 0.875rem;
164
+ color: #fff;
165
+ font-weight: normal;
166
+ width: max-content;
167
+ }
168
+ [data-v-c46e1fb5] .has-tooltip::before,[data-v-c46e1fb5] .has-tooltip::after {
169
+ text-decoration: none;
170
+ visibility: hidden;
171
+ opacity: 0;
172
+ transition: all 0.3s ease-out;
173
+ }
174
+ [data-v-c46e1fb5] .has-tooltip:hover::after,[data-v-c46e1fb5] .has-tooltip:hover::before {
175
+ visibility: visible;
176
+ opacity: 1;
177
+ margin-bottom: 0.25rem;
138
178
  }.v-sheet[data-v-8e6263e8] {
139
179
  display: flex;
140
180
  flex-direction: column;
141
181
  gap: 0.75rem;
142
- }.v-sheet[data-v-148650fc] {
182
+ }.v-sheet[data-v-426754d7] {
143
183
  display: flex;
144
184
  flex-direction: column;
145
185
  gap: 0.75rem;
@@ -148,6 +188,10 @@
148
188
  }
149
189
  .v-input--density-compact[data-v-86386e2b] {
150
190
  --v-input-control-height: unset;
191
+ }.v-sheet[data-v-9f5b7855] {
192
+ display: flex;
193
+ flex-direction: column;
194
+ gap: 0.75rem;
151
195
  }.v-list-item + .v-list-item[data-v-13c3b0cc] {
152
196
  margin-top: 0.125rem;
153
197
  }.v-list-item + .v-list-item[data-v-70882e8a] {
@@ -181,14 +225,14 @@
181
225
  border: 1px solid #dadce0;
182
226
  }.v-list-item + .v-list-item[data-v-eb5927ce] {
183
227
  margin-top: 0.125rem;
184
- }.v-btn-group[data-v-b4ffaa29] {
228
+ }.v-btn-group[data-v-62e3d651] {
185
229
  display: flex;
186
230
  flex-wrap: wrap;
187
231
  height: unset;
188
232
  }
189
- [data-v-b4ffaa29] .v-btn + .v-btn {
233
+ [data-v-62e3d651] .v-btn + .v-btn {
190
234
  margin-left: 0.125rem;
191
235
  }
192
- [data-v-b4ffaa29] .v-btn.v-btn--active {
236
+ [data-v-62e3d651] .v-btn.v-btn--active {
193
237
  color: rgba(var(--v-theme-primary));
194
238
  }
package/dist/index.js CHANGED
@@ -26166,11 +26166,10 @@ const Link = Link$1.extend({
26166
26166
  addCommands() {
26167
26167
  return {
26168
26168
  ...this.parent?.(),
26169
- setLinkText: ({ attributes, text } = {}) => ({ chain }) => {
26170
- return chain().setMark(this.name, { href: attributes?.href }).command(({ tr: tr2 }) => {
26171
- tr2.insertText(text);
26172
- return true;
26173
- }).setMeta("preventAutolink", true).run();
26169
+ setLinkText: ({ href, text } = { href: "", text: "" }) => ({ chain, state }) => {
26170
+ const { from: from2 } = state.selection;
26171
+ const to = from2 + text.length;
26172
+ return chain().insertContent(text).setTextSelection({ from: from2, to }).setMark(this.name, { href }).setMeta("preventAutolink", true).run();
26174
26173
  }
26175
26174
  };
26176
26175
  }
@@ -26196,12 +26195,51 @@ const Paragraph = Paragraph$1.extend({
26196
26195
  ];
26197
26196
  }
26198
26197
  });
26198
+ const Tooltip = Mark2.create({
26199
+ name: "tooltip",
26200
+ keepOnSplit: false,
26201
+ exitable: true,
26202
+ addAttributes() {
26203
+ return {
26204
+ "data-tooltip": {
26205
+ default: null,
26206
+ parseHTML: (element) => element.getAttribute("data-tooltip"),
26207
+ renderHTML: (attributes) => ({
26208
+ "data-tooltip": attributes["data-tooltip"]
26209
+ })
26210
+ }
26211
+ };
26212
+ },
26213
+ parseHTML() {
26214
+ return [{ tag: "span[data-tooltip]" }];
26215
+ },
26216
+ renderHTML({ HTMLAttributes }) {
26217
+ return [
26218
+ "span",
26219
+ mergeAttributes({ class: "has-tooltip" }, HTMLAttributes),
26220
+ 0
26221
+ ];
26222
+ },
26223
+ addCommands() {
26224
+ return {
26225
+ setTooltip: ({ tooltip, text } = { tooltip: "", text: "" }) => ({ chain, state }) => {
26226
+ const { from: from2 } = state.selection;
26227
+ const to = from2 + text.length;
26228
+ return chain().insertContent(text).setTextSelection({ from: from2, to }).setMark(this.name, { "data-tooltip": tooltip }).run();
26229
+ },
26230
+ unsetTooltip: () => ({ chain }) => {
26231
+ return chain().unsetMark(this.name).run();
26232
+ }
26233
+ };
26234
+ }
26235
+ });
26199
26236
  const extensions = [
26200
26237
  Color,
26201
26238
  FontFamily$1,
26202
26239
  FontSize$1,
26203
26240
  Image,
26204
26241
  Link.configure({ openOnClick: false }),
26242
+ Tooltip,
26205
26243
  StarterKit.configure({ paragraph: false }),
26206
26244
  Subscript,
26207
26245
  Superscript,
@@ -26221,7 +26259,7 @@ const extensions = [
26221
26259
  placeholder: "Enter your text..."
26222
26260
  })
26223
26261
  ];
26224
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
26262
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
26225
26263
  __name: "IconButton",
26226
26264
  props: {
26227
26265
  active: { type: Boolean },
@@ -26266,8 +26304,8 @@ const _export_sfc = (sfc, props) => {
26266
26304
  }
26267
26305
  return target;
26268
26306
  };
26269
- const IconButton = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-5f000959"]]);
26270
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
26307
+ const IconButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-5f000959"]]);
26308
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
26271
26309
  __name: "ImageMenu",
26272
26310
  props: {
26273
26311
  editor: {}
@@ -26322,8 +26360,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
26322
26360
  };
26323
26361
  }
26324
26362
  });
26325
- const ImageMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-cb530515"]]);
26326
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
26363
+ const ImageMenu = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-cb530515"]]);
26364
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
26327
26365
  __name: "TableMenu",
26328
26366
  props: {
26329
26367
  editor: {}
@@ -26422,10 +26460,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
26422
26460
  };
26423
26461
  }
26424
26462
  });
26425
- const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-e73020ec"]]);
26426
- const _hoisted_1$3 = { class: "tce-container" };
26463
+ const TableMenu = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-e73020ec"]]);
26464
+ const _hoisted_1$4 = { class: "tce-container" };
26427
26465
  const SAVE_DEBOUNCE = 3e3;
26428
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
26466
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
26429
26467
  __name: "Edit",
26430
26468
  props: {
26431
26469
  element: {},
@@ -26469,7 +26507,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
26469
26507
  }
26470
26508
  );
26471
26509
  return (_ctx, _cache) => {
26472
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
26510
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
26473
26511
  unref(editor) ? (openBlock(), createBlock(ImageMenu, {
26474
26512
  key: 0,
26475
26513
  editor: unref(editor)
@@ -26486,7 +26524,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
26486
26524
  };
26487
26525
  }
26488
26526
  });
26489
- const Edit = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e677fca4"]]);
26527
+ const Edit = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-c46e1fb5"]]);
26490
26528
  function getDefaultExportFromCjs(x) {
26491
26529
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
26492
26530
  }
@@ -26886,8 +26924,8 @@ function requireIsURL() {
26886
26924
  }
26887
26925
  var isURLExports = /* @__PURE__ */ requireIsURL();
26888
26926
  const isURL = /* @__PURE__ */ getDefaultExportFromCjs(isURLExports);
26889
- const _hoisted_1$2 = { class: "actions d-flex justify-end" };
26890
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
26927
+ const _hoisted_1$3 = { class: "actions d-flex justify-end" };
26928
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
26891
26929
  __name: "AddImage",
26892
26930
  props: {
26893
26931
  editor: {}
@@ -26994,7 +27032,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
26994
27032
  label: "Url",
26995
27033
  variant: "outlined"
26996
27034
  }, null, 8, ["modelValue", "rules"]),
26997
- createElementVNode("div", _hoisted_1$2, [
27035
+ createElementVNode("div", _hoisted_1$3, [
26998
27036
  createVNode(_component_VBtn, {
26999
27037
  color: "primary",
27000
27038
  type: "submit",
@@ -27019,9 +27057,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
27019
27057
  };
27020
27058
  }
27021
27059
  });
27022
- const AddImage = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8e6263e8"]]);
27023
- const _hoisted_1$1 = { class: "actions d-flex justify-end" };
27024
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
27060
+ const AddImage = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-8e6263e8"]]);
27061
+ const _hoisted_1$2 = { class: "actions d-flex justify-end" };
27062
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
27025
27063
  __name: "AddLink",
27026
27064
  props: {
27027
27065
  editor: {}
@@ -27055,8 +27093,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27055
27093
  if (!valid) return;
27056
27094
  const href = url.value.startsWith("http") ? url.value : `https://${url.value}`;
27057
27095
  if (href) {
27058
- const attributes = { href };
27059
- props.editor.chain().focus().setLinkText({ attributes, text: text.value }).run();
27096
+ props.editor.chain().focus().setLinkText({ href, text: text.value }).run();
27060
27097
  } else props.editor.chain().focus().unsetLink().run();
27061
27098
  show.value = false;
27062
27099
  form.value.resetValidation();
@@ -27093,7 +27130,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27093
27130
  default: withCtx(() => [
27094
27131
  createVNode(_component_VIcon, { size: "24" }, {
27095
27132
  default: withCtx(() => _cache[3] || (_cache[3] = [
27096
- createTextVNode("mdi-link")
27133
+ createTextVNode("mdi-link-variant-plus")
27097
27134
  ])),
27098
27135
  _: 1,
27099
27136
  __: [3]
@@ -27141,11 +27178,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27141
27178
  label: "Url",
27142
27179
  variant: "outlined"
27143
27180
  }, null, 8, ["modelValue", "rules"]),
27144
- createElementVNode("div", _hoisted_1$1, [
27181
+ createElementVNode("div", _hoisted_1$2, [
27145
27182
  _ctx.editor.isActive("link") ? (openBlock(), createBlock(_component_VBtn, {
27146
27183
  key: 0,
27147
27184
  class: "mr-2",
27148
- variant: "plain",
27185
+ color: "primary-darken-3",
27186
+ variant: "text",
27149
27187
  onClick: unlink
27150
27188
  }, {
27151
27189
  default: withCtx(() => _cache[5] || (_cache[5] = [
@@ -27155,12 +27193,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27155
27193
  __: [5]
27156
27194
  })) : createCommentVNode("", true),
27157
27195
  createVNode(_component_VBtn, {
27158
- color: "primary",
27196
+ color: "primary-darken-3",
27159
27197
  type: "submit",
27160
27198
  variant: "tonal"
27161
27199
  }, {
27162
27200
  default: withCtx(() => _cache[6] || (_cache[6] = [
27163
- createTextVNode("Confirm")
27201
+ createTextVNode(" Confirm ")
27164
27202
  ])),
27165
27203
  _: 1,
27166
27204
  __: [6]
@@ -27178,11 +27216,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27178
27216
  };
27179
27217
  }
27180
27218
  });
27181
- const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-148650fc"]]);
27182
- const _hoisted_1 = { class: "text-body-2" };
27219
+ const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-426754d7"]]);
27220
+ const _hoisted_1$1 = { class: "text-body-2" };
27183
27221
  const INIT_SIZE = 5;
27184
27222
  const MAX_SIZE = 10;
27185
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
27223
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27186
27224
  __name: "AddTable",
27187
27225
  props: {
27188
27226
  editor: {}
@@ -27292,7 +27330,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
27292
27330
  }), 128))
27293
27331
  ]);
27294
27332
  }), 128)),
27295
- createElementVNode("span", _hoisted_1, toDisplayString(selectedSize.rows) + "x" + toDisplayString(selectedSize.cols), 1)
27333
+ createElementVNode("span", _hoisted_1$1, toDisplayString(selectedSize.rows) + "x" + toDisplayString(selectedSize.cols), 1)
27296
27334
  ]),
27297
27335
  _: 1
27298
27336
  })
@@ -27302,7 +27340,161 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
27302
27340
  };
27303
27341
  }
27304
27342
  });
27305
- const AddTable = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-86386e2b"]]);
27343
+ const AddTable = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-86386e2b"]]);
27344
+ const _hoisted_1 = { class: "actions d-flex justify-end" };
27345
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
27346
+ __name: "AddTooltip",
27347
+ props: {
27348
+ editor: {}
27349
+ },
27350
+ setup(__props) {
27351
+ const rules = {
27352
+ required: (val) => !!val || "The field is required"
27353
+ };
27354
+ const props = __props;
27355
+ const form = ref();
27356
+ const getText2 = () => {
27357
+ const { view, state } = props.editor;
27358
+ const { from: from2, to } = view.state.selection;
27359
+ return state.doc.textBetween(from2, to, " ");
27360
+ };
27361
+ const tooltip = ref("");
27362
+ const text = ref("");
27363
+ const show = ref(false);
27364
+ function unset() {
27365
+ props.editor.chain().focus().unsetTooltip().run();
27366
+ tooltip.value = "";
27367
+ show.value = false;
27368
+ }
27369
+ async function setTooltip() {
27370
+ const { valid } = await form.value.validate();
27371
+ if (!valid) return;
27372
+ if (tooltip.value) {
27373
+ const attributes = { tooltip: tooltip.value, text: text.value };
27374
+ console.log("Setting tooltip with attributes:", attributes);
27375
+ props.editor.chain().focus().setTooltip(attributes).run();
27376
+ } else props.editor.chain().focus().unsetTooltip().run();
27377
+ show.value = false;
27378
+ form.value.resetValidation();
27379
+ }
27380
+ watch(show, (val) => {
27381
+ if (!val) return;
27382
+ tooltip.value = props.editor.getAttributes("tooltip")["data-tooltip"] ?? "";
27383
+ text.value = getText2() ?? "";
27384
+ form.value?.resetValidation();
27385
+ });
27386
+ return (_ctx, _cache) => {
27387
+ const _component_VIcon = resolveComponent("VIcon");
27388
+ const _component_VBtn = resolveComponent("VBtn");
27389
+ const _component_VTooltip = resolveComponent("VTooltip");
27390
+ const _component_VTextField = resolveComponent("VTextField");
27391
+ const _component_VSheet = resolveComponent("VSheet");
27392
+ const _component_VForm = resolveComponent("VForm");
27393
+ const _component_VMenu = resolveComponent("VMenu");
27394
+ return openBlock(), createBlock(_component_VMenu, {
27395
+ modelValue: show.value,
27396
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => show.value = $event),
27397
+ "close-on-content-click": false
27398
+ }, {
27399
+ activator: withCtx(({ props: menu }) => [
27400
+ createVNode(_component_VTooltip, { location: "bottom" }, {
27401
+ activator: withCtx(({ props: tooltipProps }) => [
27402
+ createVNode(_component_VBtn, mergeProps({
27403
+ active: _ctx.editor.isActive("tooltip"),
27404
+ disabled: !_ctx.editor.can().chain().focus().setTooltip().run(),
27405
+ "aria-label": "Add tooltip",
27406
+ rounded: "lg",
27407
+ size: "32"
27408
+ }, mergeProps(menu, tooltipProps)), {
27409
+ default: withCtx(() => [
27410
+ createVNode(_component_VIcon, { size: "24" }, {
27411
+ default: withCtx(() => _cache[3] || (_cache[3] = [
27412
+ createTextVNode("mdi-tooltip-text")
27413
+ ])),
27414
+ _: 1,
27415
+ __: [3]
27416
+ })
27417
+ ]),
27418
+ _: 2
27419
+ }, 1040, ["active", "disabled"])
27420
+ ]),
27421
+ default: withCtx(() => [
27422
+ _cache[4] || (_cache[4] = createTextVNode(" Add tooltip "))
27423
+ ]),
27424
+ _: 2,
27425
+ __: [4]
27426
+ }, 1024)
27427
+ ]),
27428
+ default: withCtx(() => [
27429
+ createVNode(_component_VForm, {
27430
+ ref_key: "form",
27431
+ ref: form,
27432
+ onSubmit: withModifiers(setTooltip, ["prevent"])
27433
+ }, {
27434
+ default: withCtx(() => [
27435
+ createVNode(_component_VSheet, {
27436
+ class: "pa-3",
27437
+ elevation: "8",
27438
+ width: "240",
27439
+ rounded: ""
27440
+ }, {
27441
+ default: withCtx(() => [
27442
+ createVNode(_component_VTextField, {
27443
+ modelValue: text.value,
27444
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => text.value = $event),
27445
+ rules: [rules.required],
27446
+ density: "compact",
27447
+ "hide-details": "auto",
27448
+ label: "Text",
27449
+ variant: "outlined"
27450
+ }, null, 8, ["modelValue", "rules"]),
27451
+ createVNode(_component_VTextField, {
27452
+ modelValue: tooltip.value,
27453
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tooltip.value = $event),
27454
+ rules: [rules.required],
27455
+ density: "compact",
27456
+ "hide-details": "auto",
27457
+ label: "Tooltip",
27458
+ variant: "outlined"
27459
+ }, null, 8, ["modelValue", "rules"]),
27460
+ createElementVNode("div", _hoisted_1, [
27461
+ _ctx.editor.isActive("tooltip") ? (openBlock(), createBlock(_component_VBtn, {
27462
+ key: 0,
27463
+ class: "mr-2",
27464
+ variant: "plain",
27465
+ onClick: unset
27466
+ }, {
27467
+ default: withCtx(() => _cache[5] || (_cache[5] = [
27468
+ createTextVNode(" Remove ")
27469
+ ])),
27470
+ _: 1,
27471
+ __: [5]
27472
+ })) : createCommentVNode("", true),
27473
+ createVNode(_component_VBtn, {
27474
+ color: "primary",
27475
+ type: "submit",
27476
+ variant: "tonal"
27477
+ }, {
27478
+ default: withCtx(() => _cache[6] || (_cache[6] = [
27479
+ createTextVNode("Confirm")
27480
+ ])),
27481
+ _: 1,
27482
+ __: [6]
27483
+ })
27484
+ ])
27485
+ ]),
27486
+ _: 1
27487
+ })
27488
+ ]),
27489
+ _: 1
27490
+ }, 512)
27491
+ ]),
27492
+ _: 1
27493
+ }, 8, ["modelValue"]);
27494
+ };
27495
+ }
27496
+ });
27497
+ const AddTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9f5b7855"]]);
27306
27498
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
27307
27499
  __name: "FontFamily",
27308
27500
  props: {
@@ -27997,6 +28189,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
27997
28189
  { component: AddLink },
27998
28190
  { component: AddTable },
27999
28191
  { component: AddImage },
28192
+ { component: AddTooltip },
28000
28193
  {
28001
28194
  label: "Horizontal line",
28002
28195
  action: ["setHorizontalRule"],
@@ -28110,7 +28303,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
28110
28303
  };
28111
28304
  }
28112
28305
  });
28113
- const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b4ffaa29"]]);
28306
+ const EditorToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-62e3d651"]]);
28114
28307
  const _sfc_main = /* @__PURE__ */ defineComponent({
28115
28308
  __name: "TopToolbar",
28116
28309
  props: {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Tailor CMS HTML editor authoring component",
4
4
  "author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
5
5
  "type": "module",
6
- "version": "0.1.1",
6
+ "version": "0.1.3",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "typescript": "^5.8.3",
27
27
  "vite": "^7.0.3",
28
28
  "vue-tsc": "^3.0.1",
29
- "@tailor-cms/ce-html-manifest": "0.1.1"
29
+ "@tailor-cms/ce-html-manifest": "0.1.3"
30
30
  },
31
31
  "dependencies": {
32
32
  "@tiptap/extension-color": "^2.25.0",