@ctzhian/tiptap 1.13.6 → 1.13.7
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/Editor/demo.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Editor, EditorThemeProvider, EditorToolbar, useTiptap } from "./..";
|
|
|
6
6
|
import { Box } from '@mui/material';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import "../index.css";
|
|
9
|
+
var defaultContent = "";
|
|
9
10
|
var Reader = function Reader() {
|
|
10
11
|
var handleTocUpdate = function handleTocUpdate(toc) {
|
|
11
12
|
console.log('toc', toc);
|
|
@@ -155,7 +156,7 @@ var Reader = function Reader() {
|
|
|
155
156
|
}
|
|
156
157
|
return onUpload;
|
|
157
158
|
}(),
|
|
158
|
-
content:
|
|
159
|
+
content: defaultContent
|
|
159
160
|
}),
|
|
160
161
|
editor = _useTiptap.editor;
|
|
161
162
|
return /*#__PURE__*/React.createElement(EditorThemeProvider, {
|
|
@@ -15,6 +15,9 @@ import { clickHandler } from "./helpers/clickHandler";
|
|
|
15
15
|
import { pasteHandler } from "./helpers/pasteHandler";
|
|
16
16
|
import { UNICODE_WHITESPACE_REGEX_GLOBAL } from "./helpers/whitespace";
|
|
17
17
|
|
|
18
|
+
// export const pasteRegex =
|
|
19
|
+
// /https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* @deprecated The default behavior is now to open links when the editor is not editable.
|
|
20
23
|
*/
|
|
@@ -365,6 +368,20 @@ export var InlineLinkExtension = Node.create({
|
|
|
365
368
|
}
|
|
366
369
|
};
|
|
367
370
|
},
|
|
371
|
+
markdownTokenName: 'link',
|
|
372
|
+
parseMarkdown: function parseMarkdown(token, helpers) {
|
|
373
|
+
return helpers.createNode('inlineLink', {
|
|
374
|
+
href: token.href || '',
|
|
375
|
+
title: token.title || null,
|
|
376
|
+
type: 'icon'
|
|
377
|
+
}, [helpers.createTextNode(token.text || '')]);
|
|
378
|
+
},
|
|
379
|
+
renderMarkdown: function renderMarkdown(node, h) {
|
|
380
|
+
var _node$attrs;
|
|
381
|
+
var href = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.href) || '';
|
|
382
|
+
var text = h.renderChildren(node);
|
|
383
|
+
return "[".concat(text, "](").concat(href, ")");
|
|
384
|
+
},
|
|
368
385
|
addNodeView: function addNodeView() {
|
|
369
386
|
return ReactNodeViewRenderer(LinkViewWrapper);
|
|
370
387
|
}
|