@tiptap/vue-2 3.0.0-beta.0 → 3.0.0-beta.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.
- package/dist/index.cjs +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/menus/index.cjs +11 -37
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.js +9 -35
- package/dist/menus/index.js.map +1 -1
- package/package.json +5 -5
- package/src/VueNodeViewRenderer.ts +1 -3
package/dist/menus/index.js
CHANGED
|
@@ -1868,19 +1868,18 @@ var BubbleMenu = {
|
|
|
1868
1868
|
}
|
|
1869
1869
|
};
|
|
1870
1870
|
|
|
1871
|
-
// ../extension-floating-menu/
|
|
1872
|
-
import { Extension } from "@tiptap/core";
|
|
1871
|
+
// ../extension-floating-menu/src/floating-menu-plugin.ts
|
|
1873
1872
|
import { getText, getTextSerializersFromSchema, posToDOMRect as posToDOMRect2 } from "@tiptap/core";
|
|
1874
1873
|
import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
1875
1874
|
var FloatingMenuView = class {
|
|
1876
1875
|
constructor({ editor, element, view, options, shouldShow }) {
|
|
1877
1876
|
this.preventHide = false;
|
|
1878
|
-
this.shouldShow = ({ view
|
|
1877
|
+
this.shouldShow = ({ view, state }) => {
|
|
1879
1878
|
const { selection } = state;
|
|
1880
1879
|
const { $anchor, empty } = selection;
|
|
1881
1880
|
const isRootDepth = $anchor.depth === 1;
|
|
1882
1881
|
const isEmptyTextBlock = $anchor.parent.isTextblock && !$anchor.parent.type.spec.code && !$anchor.parent.textContent && $anchor.parent.childCount === 0 && !this.getTextContent($anchor.parent);
|
|
1883
|
-
if (!
|
|
1882
|
+
if (!view.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) {
|
|
1884
1883
|
return false;
|
|
1885
1884
|
}
|
|
1886
1885
|
return true;
|
|
@@ -1897,14 +1896,14 @@ var FloatingMenuView = class {
|
|
|
1897
1896
|
hide: false,
|
|
1898
1897
|
inline: false
|
|
1899
1898
|
};
|
|
1900
|
-
this.updateHandler = (
|
|
1901
|
-
const { composing } =
|
|
1899
|
+
this.updateHandler = (view, selectionChanged, docChanged, oldState) => {
|
|
1900
|
+
const { composing } = view;
|
|
1902
1901
|
const isSame = !selectionChanged && !docChanged;
|
|
1903
1902
|
if (composing || isSame) {
|
|
1904
1903
|
return;
|
|
1905
1904
|
}
|
|
1906
|
-
const
|
|
1907
|
-
if (!
|
|
1905
|
+
const shouldShow = this.getShouldShow(oldState);
|
|
1906
|
+
if (!shouldShow) {
|
|
1908
1907
|
this.hide();
|
|
1909
1908
|
return;
|
|
1910
1909
|
}
|
|
@@ -2052,34 +2051,9 @@ var FloatingMenuPlugin = (options) => {
|
|
|
2052
2051
|
view: (view) => new FloatingMenuView({ view, ...options })
|
|
2053
2052
|
});
|
|
2054
2053
|
};
|
|
2055
|
-
var FloatingMenu = Extension.create({
|
|
2056
|
-
name: "floatingMenu",
|
|
2057
|
-
addOptions() {
|
|
2058
|
-
return {
|
|
2059
|
-
element: null,
|
|
2060
|
-
options: {},
|
|
2061
|
-
pluginKey: "floatingMenu",
|
|
2062
|
-
shouldShow: null
|
|
2063
|
-
};
|
|
2064
|
-
},
|
|
2065
|
-
addProseMirrorPlugins() {
|
|
2066
|
-
if (!this.options.element) {
|
|
2067
|
-
return [];
|
|
2068
|
-
}
|
|
2069
|
-
return [
|
|
2070
|
-
FloatingMenuPlugin({
|
|
2071
|
-
pluginKey: this.options.pluginKey,
|
|
2072
|
-
editor: this.editor,
|
|
2073
|
-
element: this.options.element,
|
|
2074
|
-
options: this.options.options,
|
|
2075
|
-
shouldShow: this.options.shouldShow
|
|
2076
|
-
})
|
|
2077
|
-
];
|
|
2078
|
-
}
|
|
2079
|
-
});
|
|
2080
2054
|
|
|
2081
2055
|
// src/menus/FloatingMenu.ts
|
|
2082
|
-
var
|
|
2056
|
+
var FloatingMenu = {
|
|
2083
2057
|
name: "FloatingMenu",
|
|
2084
2058
|
props: {
|
|
2085
2059
|
pluginKey: {
|
|
@@ -2133,6 +2107,6 @@ var FloatingMenu2 = {
|
|
|
2133
2107
|
};
|
|
2134
2108
|
export {
|
|
2135
2109
|
BubbleMenu,
|
|
2136
|
-
|
|
2110
|
+
FloatingMenu
|
|
2137
2111
|
};
|
|
2138
2112
|
//# sourceMappingURL=index.js.map
|