@ctzhian/tiptap 1.13.6 → 1.13.8

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.
@@ -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: "<pre><code>$$ sflsa $$\n\n$fsjadl$</code></pre><p></p><p><span data-latex=\"x+y=1\" data-type=\"inline-math\"></span></p><div data-latex=\"ssss\" data-type=\"block-math\"></div><p></p><p>fadsjlfkas</p><div data-type=\"flow\" data-code=\"C4Context\n title System Context diagram for Internet Banking System\n Enterprise_Boundary(b0, &quot;BankBoundary0&quot;) {\n Person(customerA, &quot;Banking Customer A&quot;, &quot;A customer of the bank, with personal bank accounts.&quot;)\n Person(customerB, &quot;Banking Customer B&quot;)\n Person_Ext(customerC, &quot;Banking Customer C&quot;, &quot;desc&quot;)\n\n Person(customerD, &quot;Banking Customer D&quot;, &quot;A customer of the bank, &lt;br/&gt; with personal bank accounts.&quot;)\n\n System(SystemAA, &quot;Internet Banking System&quot;, &quot;Allows customers to view information about their bank accounts, and make payments.&quot;)\n\n Enterprise_Boundary(b1, &quot;BankBoundary&quot;) {\n SystemDb_Ext(SystemE, &quot;Mainframe Banking System&quot;, &quot;Stores all of the core banking information about customers, accounts, transactions, etc.&quot;)\n\n System_Boundary(b2, &quot;BankBoundary2&quot;) {\n System(SystemA, &quot;Banking System A&quot;)\n System(SystemB, &quot;Banking System B&quot;, &quot;A system of the bank, with personal bank accounts. next line.&quot;)\n }\n\n System_Ext(SystemC, &quot;E-mail system&quot;, &quot;The internal Microsoft Exchange e-mail system.&quot;)\n SystemDb(SystemD, &quot;Banking System D Database&quot;, &quot;A system of the bank, with personal bank accounts.&quot;)\n\n Boundary(b3, &quot;BankBoundary3&quot;, &quot;boundary&quot;) {\n SystemQueue(SystemF, &quot;Banking System F Queue&quot;, &quot;A system of the bank.&quot;)\n SystemQueue_Ext(SystemG, &quot;Banking System G Queue&quot;, &quot;A system of the bank, with personal bank accounts.&quot;)\n }\n }\n }\n\n BiRel(customerA, SystemAA, &quot;Uses&quot;)\n BiRel(SystemAA, SystemE, &quot;Uses&quot;)\n Rel(SystemAA, SystemC, &quot;Sends e-mails&quot;, &quot;SMTP&quot;)\n Rel(SystemC, customerA, &quot;Sends e-mails to&quot;)\" data-width=\"100%\" data-height=\"auto\"></div><p>fsajdlkfjadsl</p>"
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,21 @@ 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
+ target: '_blank'
378
+ }, [helpers.createTextNode(token.text || '')]);
379
+ },
380
+ renderMarkdown: function renderMarkdown(node, h) {
381
+ var _node$attrs;
382
+ var href = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.href) || '';
383
+ var text = h.renderChildren(node);
384
+ return "[".concat(text, "](").concat(href, ")");
385
+ },
368
386
  addNodeView: function addNodeView() {
369
387
  return ReactNodeViewRenderer(LinkViewWrapper);
370
388
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.13.6",
3
+ "version": "1.13.8",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",