@meowdown/core 0.78.1 → 0.78.2
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.js +22 -26
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1927,10 +1927,6 @@ function defineEditorCommands() {
|
|
|
1927
1927
|
|
|
1928
1928
|
//#endregion
|
|
1929
1929
|
//#region src/extensions/cross-editor-drag.ts
|
|
1930
|
-
const mountedViews = /* @__PURE__ */ new Set();
|
|
1931
|
-
function findDragSource(target) {
|
|
1932
|
-
for (const view of mountedViews) if (view !== target && !view.isDestroyed && view.editable && view.dragging) return view;
|
|
1933
|
-
}
|
|
1934
1930
|
function deleteDraggedContent(view, dragging) {
|
|
1935
1931
|
const tr = view.state.tr;
|
|
1936
1932
|
if (dragging.node) {
|
|
@@ -1940,41 +1936,41 @@ function deleteDraggedContent(view, dragging) {
|
|
|
1940
1936
|
if (!tr.docChanged) return;
|
|
1941
1937
|
view.dispatch(tr.setMeta("uiEvent", "drop"));
|
|
1942
1938
|
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
if (target.state.doc === docBeforeDrop) return;
|
|
1955
|
-
deleteDraggedContent(source, dragging);
|
|
1956
|
-
});
|
|
1957
|
-
return false;
|
|
1939
|
+
/**
|
|
1940
|
+
* Remove the content that a finished drag moved out of `view`. `dropEffect` is
|
|
1941
|
+
* the value the drag source reads on `dragend`.
|
|
1942
|
+
*
|
|
1943
|
+
* @internal
|
|
1944
|
+
*/
|
|
1945
|
+
function removeMovedContent(view, dropEffect) {
|
|
1946
|
+
const dragging = view.dragging;
|
|
1947
|
+
if (!dragging || !view.editable || dropEffect !== "move") return;
|
|
1948
|
+
view.dragging = null;
|
|
1949
|
+
deleteDraggedContent(view, dragging);
|
|
1958
1950
|
}
|
|
1959
1951
|
function createCrossEditorDragPlugin() {
|
|
1960
1952
|
return new Plugin({
|
|
1961
1953
|
key: new PluginKey("meowdown-cross-editor-drag"),
|
|
1962
1954
|
view: (view) => {
|
|
1963
|
-
|
|
1955
|
+
const ownerDocument = view.dom.ownerDocument;
|
|
1956
|
+
const handleDragEnd = (event) => {
|
|
1957
|
+
removeMovedContent(view, event.dataTransfer?.dropEffect);
|
|
1958
|
+
};
|
|
1959
|
+
ownerDocument.addEventListener("dragend", handleDragEnd);
|
|
1964
1960
|
return { destroy: () => {
|
|
1965
|
-
|
|
1961
|
+
ownerDocument.removeEventListener("dragend", handleDragEnd);
|
|
1966
1962
|
} };
|
|
1967
|
-
}
|
|
1968
|
-
props: { handleDrop: handleCrossEditorDrop }
|
|
1963
|
+
}
|
|
1969
1964
|
});
|
|
1970
1965
|
}
|
|
1971
1966
|
/**
|
|
1972
|
-
* Dragging
|
|
1973
|
-
*
|
|
1967
|
+
* Dragging content out of a meowdown editor moves it when the drop target
|
|
1968
|
+
* accepts a move: another meowdown editor on the same page, or one in another
|
|
1969
|
+
* window or tab. The content leaves the source document once the drag ends.
|
|
1974
1970
|
* Hold Alt (Ctrl on Windows and Linux) to copy instead.
|
|
1975
1971
|
*/
|
|
1976
1972
|
function defineCrossEditorDrag() {
|
|
1977
|
-
return
|
|
1973
|
+
return definePlugin(createCrossEditorDragPlugin());
|
|
1978
1974
|
}
|
|
1979
1975
|
|
|
1980
1976
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowdown/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.78.
|
|
4
|
+
"version": "0.78.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@floating-ui/dom": "^1.8.0",
|
|
27
27
|
"@lezer/highlight": "^1.2.3",
|
|
28
28
|
"@meowdown/embed": "0.3.1",
|
|
29
|
-
"@meowdown/markdown": "0.
|
|
29
|
+
"@meowdown/markdown": "0.75.0",
|
|
30
30
|
"@ocavue/utils": "^1.8.0",
|
|
31
31
|
"@post-embed/exporter": "^0.5.0",
|
|
32
32
|
"@post-embed/schema": "^0.5.2",
|