mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-09 20:12:00 +10:00
fix: move markdown clipboard extension to client app
This commit is contained in:
@ -36,7 +36,6 @@ import {
|
|||||||
Drawio,
|
Drawio,
|
||||||
Excalidraw,
|
Excalidraw,
|
||||||
Embed,
|
Embed,
|
||||||
MarkdownClipboard,
|
|
||||||
} from "@docmost/editor-ext";
|
} from "@docmost/editor-ext";
|
||||||
import {
|
import {
|
||||||
randomElement,
|
randomElement,
|
||||||
@ -66,6 +65,7 @@ import fortran from "highlight.js/lib/languages/fortran";
|
|||||||
import haskell from "highlight.js/lib/languages/haskell";
|
import haskell from "highlight.js/lib/languages/haskell";
|
||||||
import scala from "highlight.js/lib/languages/scala";
|
import scala from "highlight.js/lib/languages/scala";
|
||||||
import i18n from "@/i18n.ts";
|
import i18n from "@/i18n.ts";
|
||||||
|
import { MarkdownClipboard } from "@/features/editor/extensions/markdown-clipboard.ts";
|
||||||
|
|
||||||
const lowlight = createLowlight(common);
|
const lowlight = createLowlight(common);
|
||||||
lowlight.register("mermaid", plaintext);
|
lowlight.register("mermaid", plaintext);
|
||||||
@ -133,7 +133,6 @@ export const mainExtensions = [
|
|||||||
class: "comment-mark",
|
class: "comment-mark",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Table.configure({
|
Table.configure({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
lastColumnResizable: false,
|
lastColumnResizable: false,
|
||||||
@ -142,7 +141,6 @@ export const mainExtensions = [
|
|||||||
TableRow,
|
TableRow,
|
||||||
TableCell,
|
TableCell,
|
||||||
TableHeader,
|
TableHeader,
|
||||||
|
|
||||||
MathInline.configure({
|
MathInline.configure({
|
||||||
view: MathInlineView,
|
view: MathInlineView,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -2,16 +2,13 @@
|
|||||||
import { Extension } from "@tiptap/core";
|
import { Extension } from "@tiptap/core";
|
||||||
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
||||||
import { DOMParser } from "@tiptap/pm/model";
|
import { DOMParser } from "@tiptap/pm/model";
|
||||||
import { markdownToHtml } from "./utils/marked.utils";
|
|
||||||
import { find } from "linkifyjs";
|
import { find } from "linkifyjs";
|
||||||
|
import { markdownToHtml } from "@docmost/editor-ext";
|
||||||
|
|
||||||
export const MarkdownClipboard = Extension.create({
|
export const MarkdownClipboard = Extension.create({
|
||||||
name: "markdownClipboard",
|
name: "markdownClipboard",
|
||||||
priority: 50,
|
priority: 50,
|
||||||
|
|
||||||
export const MarkdownClipboard = Extension.create({
|
|
||||||
name: "markdownClipboard",
|
|
||||||
|
|
||||||
addOptions() {
|
addOptions() {
|
||||||
return {
|
return {
|
||||||
transformPastedText: false,
|
transformPastedText: false,
|
||||||
@ -23,7 +20,6 @@ export const MarkdownClipboard = Extension.create({
|
|||||||
key: new PluginKey("markdownClipboard"),
|
key: new PluginKey("markdownClipboard"),
|
||||||
props: {
|
props: {
|
||||||
clipboardTextParser: (text, context, plainText) => {
|
clipboardTextParser: (text, context, plainText) => {
|
||||||
|
|
||||||
const link = find(text, {
|
const link = find(text, {
|
||||||
defaultProtocol: "http",
|
defaultProtocol: "http",
|
||||||
}).find((item) => item.isLink && item.value === text);
|
}).find((item) => item.isLink && item.value === text);
|
||||||
@ -33,7 +29,7 @@ export const MarkdownClipboard = Extension.create({
|
|||||||
// pasting with shift key prevents formatting
|
// pasting with shift key prevents formatting
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsed = markdownToHtml(text);
|
const parsed = markdownToHtml(text);
|
||||||
return DOMParser.fromSchema(this.editor.schema).parseSlice(
|
return DOMParser.fromSchema(this.editor.schema).parseSlice(
|
||||||
elementFromString(parsed),
|
elementFromString(parsed),
|
||||||
@ -1,2 +1 @@
|
|||||||
export * from "./markdown-clipboard";
|
|
||||||
export * from "./utils/marked.utils";
|
export * from "./utils/marked.utils";
|
||||||
|
|||||||
Reference in New Issue
Block a user