@tiptap/vue-2 3.5.0 → 3.5.1

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.
@@ -111,6 +111,7 @@ interface BubbleMenuInterface extends Vue {
111
111
  editor: BubbleMenuPluginProps['editor'];
112
112
  updateDelay: BubbleMenuPluginProps['updateDelay'];
113
113
  resizeDelay: BubbleMenuPluginProps['resizeDelay'];
114
+ appendTo: BubbleMenuPluginProps['appendTo'];
114
115
  shouldShow: BubbleMenuPluginProps['shouldShow'];
115
116
  getReferencedVirtualElement: BubbleMenuPluginProps['getReferencedVirtualElement'];
116
117
  options: BubbleMenuPluginProps['options'];
@@ -133,6 +134,15 @@ interface FloatingMenuPluginProps {
133
134
  * @default null
134
135
  */
135
136
  element: HTMLElement;
137
+ /**
138
+ * The DOM element to append your menu to. Default is the editor's parent element.
139
+ *
140
+ * Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
141
+ *
142
+ * @type {HTMLElement}
143
+ * @default null
144
+ */
145
+ appendTo?: HTMLElement;
136
146
  /**
137
147
  * A function that determines whether the menu should be shown or not.
138
148
  * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
@@ -173,6 +183,7 @@ interface FloatingMenuInterface extends Vue {
173
183
  pluginKey: FloatingMenuPluginProps['pluginKey'];
174
184
  options: FloatingMenuPluginProps['options'];
175
185
  editor: FloatingMenuPluginProps['editor'];
186
+ appendTo: FloatingMenuPluginProps['appendTo'];
176
187
  shouldShow: FloatingMenuPluginProps['shouldShow'];
177
188
  }
178
189
  declare const FloatingMenu: Component;
@@ -111,6 +111,7 @@ interface BubbleMenuInterface extends Vue {
111
111
  editor: BubbleMenuPluginProps['editor'];
112
112
  updateDelay: BubbleMenuPluginProps['updateDelay'];
113
113
  resizeDelay: BubbleMenuPluginProps['resizeDelay'];
114
+ appendTo: BubbleMenuPluginProps['appendTo'];
114
115
  shouldShow: BubbleMenuPluginProps['shouldShow'];
115
116
  getReferencedVirtualElement: BubbleMenuPluginProps['getReferencedVirtualElement'];
116
117
  options: BubbleMenuPluginProps['options'];
@@ -133,6 +134,15 @@ interface FloatingMenuPluginProps {
133
134
  * @default null
134
135
  */
135
136
  element: HTMLElement;
137
+ /**
138
+ * The DOM element to append your menu to. Default is the editor's parent element.
139
+ *
140
+ * Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
141
+ *
142
+ * @type {HTMLElement}
143
+ * @default null
144
+ */
145
+ appendTo?: HTMLElement;
136
146
  /**
137
147
  * A function that determines whether the menu should be shown or not.
138
148
  * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
@@ -173,6 +183,7 @@ interface FloatingMenuInterface extends Vue {
173
183
  pluginKey: FloatingMenuPluginProps['pluginKey'];
174
184
  options: FloatingMenuPluginProps['options'];
175
185
  editor: FloatingMenuPluginProps['editor'];
186
+ appendTo: FloatingMenuPluginProps['appendTo'];
176
187
  shouldShow: FloatingMenuPluginProps['shouldShow'];
177
188
  }
178
189
  declare const FloatingMenu: Component;
@@ -1969,6 +1969,10 @@ var BubbleMenu2 = {
1969
1969
  resizeDelay: {
1970
1970
  type: Number
1971
1971
  },
1972
+ appendTo: {
1973
+ type: Object,
1974
+ default: void 0
1975
+ },
1972
1976
  shouldShow: {
1973
1977
  type: Function,
1974
1978
  default: null
@@ -1994,6 +1998,7 @@ var BubbleMenu2 = {
1994
1998
  editor,
1995
1999
  element: this.$el,
1996
2000
  pluginKey: this.pluginKey,
2001
+ appendTo: this.appendTo,
1997
2002
  shouldShow: this.shouldShow,
1998
2003
  getReferencedVirtualElement: this.getReferencedVirtualElement
1999
2004
  })
@@ -2015,7 +2020,7 @@ import { Extension as Extension2 } from "@tiptap/core";
2015
2020
  import { getText, getTextSerializersFromSchema, posToDOMRect as posToDOMRect2 } from "@tiptap/core";
2016
2021
  import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
2017
2022
  var FloatingMenuView = class {
2018
- constructor({ editor, element, view, options, shouldShow }) {
2023
+ constructor({ editor, element, view, options, appendTo, shouldShow }) {
2019
2024
  this.preventHide = false;
2020
2025
  this.isVisible = false;
2021
2026
  this.shouldShow = ({ view: view2, state }) => {
@@ -2077,6 +2082,7 @@ var FloatingMenuView = class {
2077
2082
  this.editor = editor;
2078
2083
  this.element = element;
2079
2084
  this.view = view;
2085
+ this.appendTo = appendTo;
2080
2086
  this.floatingUIOptions = {
2081
2087
  ...this.floatingUIOptions,
2082
2088
  ...options
@@ -2178,13 +2184,13 @@ var FloatingMenuView = class {
2178
2184
  this.updateHandler(view, selectionChanged, docChanged, oldState);
2179
2185
  }
2180
2186
  show() {
2181
- var _a;
2187
+ var _a, _b;
2182
2188
  if (this.isVisible) {
2183
2189
  return;
2184
2190
  }
2185
2191
  this.element.style.visibility = "visible";
2186
2192
  this.element.style.opacity = "1";
2187
- (_a = this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
2193
+ (_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
2188
2194
  if (this.floatingUIOptions.onShow) {
2189
2195
  this.floatingUIOptions.onShow();
2190
2196
  }
@@ -2225,6 +2231,7 @@ var FloatingMenu = Extension2.create({
2225
2231
  element: null,
2226
2232
  options: {},
2227
2233
  pluginKey: "floatingMenu",
2234
+ appendTo: void 0,
2228
2235
  shouldShow: null
2229
2236
  };
2230
2237
  },
@@ -2238,6 +2245,7 @@ var FloatingMenu = Extension2.create({
2238
2245
  editor: this.editor,
2239
2246
  element: this.options.element,
2240
2247
  options: this.options.options,
2248
+ appendTo: this.options.appendTo,
2241
2249
  shouldShow: this.options.shouldShow
2242
2250
  })
2243
2251
  ];
@@ -2260,6 +2268,10 @@ var FloatingMenu2 = {
2260
2268
  type: Object,
2261
2269
  default: () => ({})
2262
2270
  },
2271
+ appendTo: {
2272
+ type: Object,
2273
+ default: void 0
2274
+ },
2263
2275
  shouldShow: {
2264
2276
  type: Function,
2265
2277
  default: null
@@ -2283,6 +2295,7 @@ var FloatingMenu2 = {
2283
2295
  editor,
2284
2296
  element: this.$el,
2285
2297
  options: this.options,
2298
+ appendTo: this.appendTo,
2286
2299
  shouldShow: this.shouldShow
2287
2300
  })
2288
2301
  );