@tailor-cms/ce-html-edit 0.1.2 → 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.
@@ -3,8 +3,8 @@ declare module '@tiptap/vue-3' {
3
3
  interface Commands<ReturnType> {
4
4
  tooltip: {
5
5
  setTooltip: (attributes: {
6
- tooltip?: string;
7
- text?: string;
6
+ tooltip: string;
7
+ text: string;
8
8
  }) => ReturnType;
9
9
  unsetTooltip: () => ReturnType;
10
10
  };
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
  }
@@ -26200,6 +26199,8 @@ const Paragraph = Paragraph$1.extend({
26200
26199
  });
26201
26200
  const Tooltip = Mark2.create({
26202
26201
  name: "tooltip",
26202
+ keepOnSplit: false,
26203
+ exitable: true,
26203
26204
  addAttributes() {
26204
26205
  return {
26205
26206
  "data-tooltip": {
@@ -26223,11 +26224,10 @@ const Tooltip = Mark2.create({
26223
26224
  },
26224
26225
  addCommands() {
26225
26226
  return {
26226
- setTooltip: ({ tooltip, text } = {}) => ({ chain }) => {
26227
- return chain().setMark(this.name, { "data-tooltip": tooltip }).command(({ tr: tr2 }) => {
26228
- tr2.insertText(text);
26229
- return true;
26230
- }).run();
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
26231
  },
26232
26232
  unsetTooltip: () => ({ chain }) => {
26233
26233
  return chain().unsetMark(this.name).run();
@@ -27095,8 +27095,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
27095
27095
  if (!valid) return;
27096
27096
  const href = url.value.startsWith("http") ? url.value : `https://${url.value}`;
27097
27097
  if (href) {
27098
- const attributes = { href };
27099
- props.editor.chain().focus().setLinkText({ attributes, text: text.value }).run();
27098
+ props.editor.chain().focus().setLinkText({ href, text: text.value }).run();
27100
27099
  } else props.editor.chain().focus().unsetLink().run();
27101
27100
  show.value = false;
27102
27101
  form.value.resetValidation();
@@ -27219,7 +27218,7 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
27219
27218
  };
27220
27219
  }
27221
27220
  });
27222
- const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8c3b7b32"]]);
27221
+ const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-426754d7"]]);
27223
27222
  const _hoisted_1$1 = { class: "text-body-2" };
27224
27223
  const INIT_SIZE = 5;
27225
27224
  const MAX_SIZE = 10;
package/dist/index.css CHANGED
@@ -179,7 +179,7 @@
179
179
  display: flex;
180
180
  flex-direction: column;
181
181
  gap: 0.75rem;
182
- }.v-sheet[data-v-8c3b7b32] {
182
+ }.v-sheet[data-v-426754d7] {
183
183
  display: flex;
184
184
  flex-direction: column;
185
185
  gap: 0.75rem;
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
  }
@@ -26198,6 +26197,8 @@ const Paragraph = Paragraph$1.extend({
26198
26197
  });
26199
26198
  const Tooltip = Mark2.create({
26200
26199
  name: "tooltip",
26200
+ keepOnSplit: false,
26201
+ exitable: true,
26201
26202
  addAttributes() {
26202
26203
  return {
26203
26204
  "data-tooltip": {
@@ -26221,11 +26222,10 @@ const Tooltip = Mark2.create({
26221
26222
  },
26222
26223
  addCommands() {
26223
26224
  return {
26224
- setTooltip: ({ tooltip, text } = {}) => ({ chain }) => {
26225
- return chain().setMark(this.name, { "data-tooltip": tooltip }).command(({ tr: tr2 }) => {
26226
- tr2.insertText(text);
26227
- return true;
26228
- }).run();
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
26229
  },
26230
26230
  unsetTooltip: () => ({ chain }) => {
26231
26231
  return chain().unsetMark(this.name).run();
@@ -27093,8 +27093,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
27093
27093
  if (!valid) return;
27094
27094
  const href = url.value.startsWith("http") ? url.value : `https://${url.value}`;
27095
27095
  if (href) {
27096
- const attributes = { href };
27097
- props.editor.chain().focus().setLinkText({ attributes, text: text.value }).run();
27096
+ props.editor.chain().focus().setLinkText({ href, text: text.value }).run();
27098
27097
  } else props.editor.chain().focus().unsetLink().run();
27099
27098
  show.value = false;
27100
27099
  form.value.resetValidation();
@@ -27217,7 +27216,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
27217
27216
  };
27218
27217
  }
27219
27218
  });
27220
- const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8c3b7b32"]]);
27219
+ const AddLink = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-426754d7"]]);
27221
27220
  const _hoisted_1$1 = { class: "text-body-2" };
27222
27221
  const INIT_SIZE = 5;
27223
27222
  const MAX_SIZE = 10;
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.2",
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.2"
29
+ "@tailor-cms/ce-html-manifest": "0.1.3"
30
30
  },
31
31
  "dependencies": {
32
32
  "@tiptap/extension-color": "^2.25.0",