@ctzhian/tiptap 2.8.0 → 2.9.0
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 +2 -2
- package/dist/asset/css/index.css +16 -12
- package/dist/component/CustomBubbleMenu/TooltipInputPopover.d.ts +11 -0
- package/dist/component/CustomBubbleMenu/TooltipInputPopover.js +80 -0
- package/dist/component/CustomBubbleMenu/index.js +39 -36
- package/dist/component/CustomDragHandle/index.js +65 -18
- package/dist/component/Icons/index.d.ts +1 -0
- package/dist/component/Icons/index.js +1 -0
- package/dist/component/Icons/tooltip-line-icon.d.ts +6 -0
- package/dist/component/Icons/tooltip-line-icon.js +13 -0
- package/dist/extension/component/CodeBlock/index.js +18 -5
- package/dist/extension/component/Image/index.js +57 -46
- package/dist/extension/component/Tooltip/index.d.ts +4 -0
- package/dist/extension/component/Tooltip/index.js +19 -0
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/index.js +5 -9
- package/dist/extension/mark/Tooltip.d.ts +24 -0
- package/dist/extension/mark/Tooltip.js +141 -0
- package/dist/index.css +1 -1
- package/package.json +1 -1
package/dist/Editor/demo.js
CHANGED
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import "../index.css";
|
|
9
9
|
var EDITABLE = true;
|
|
10
10
|
var DEFAULT_CONTENT_TYPE = 'html';
|
|
11
|
-
var DEFAULT_HTML_CONTENT = "<p></p>\n<table style=\"--default-cell-min-width: 100px; min-width: 700px;\"><colgroup><col><col><col><col><col><col><col></colgroup><tbody><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>1</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>2</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>3</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>4</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>5</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>6</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>7</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>q</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>w</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>e</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>r</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>t</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>y</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>u</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>a</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>s</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>d</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>f</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>g</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>h</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>j</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>z</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>x</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>c</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>v</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>b</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>n</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>m</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>i</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>o</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>p</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>k</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>l</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>8</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>9</p></td></tr></tbody></table>\n<hr />\n<div data-type=\"flip-grid\" class=\"flip-grid\"><div data-type=\"flip-grid-column\" data-width=\"42.99\" style=\"width: 42.99%;\"><p><span>PandaWiki \u662F\u4E00\u6B3E AI \u5927\u6A21<code>\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D</code>\u5EFA\u7CFB\u7EDF\uFF0CF<strong>AQ \u3001 \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI </strong>\u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u501F</span><span style=\"color: rgb(90, 141, 218);\">\u52A9\u5927\u6A21\u578B\u7684</span><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B\u91CF\u4E3A\u4F60\u63D0</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B AI \u521B</span><span>\u4F5C\u80FD\u529B\u3002PandaWiki \u662F<u>\u4E00\u6B3E AI \u5927\u6A21\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D\u5EFA\u7CFB\u7EDF\uFF0C\u5E2E</u>\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u667A\u80FD\u5316\u7684 <s><u>\u4EA7\u54C1\u6587\u6863\u3001\u6280\u672F</u></s>\u6587\u6863\u3001FAQ \u3001<s> \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684</s>\u529B\u91CF\u7CFB\u7EDF \uFF0C</span><span style=\"background-color: rgb(172, 84, 84);\">\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE</span><span>\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u7684\u529B\u91CF\u4E3A<mark>\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001</mark> AI \u641C\u7D22\u3002</span></p></div><div data-type=\"flip-grid-column\" data-width=\"38.92\" style=\"width: 38.92%;\"><pre><code>var a = 1;\nvar b = 2;\n\nfunction sum(a, b) {\n return a + b\n}</code></pre></div><div data-type=\"flip-grid-column\" data-width=\"18.09\" style=\"width: 18.09%;\"><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u653E\u5047\u554A\u4F46\u662F\u53EF</p></li><li><p>\u653E\u7684\u65F6\u95F4\u653E\u5047</p></li><li><p>\u53EF\u53C2\u8003</p></li><li><p>\u987A\u4E30\u6253\u5361\u5566</p></li></ul></div></div>\n<div data-type=\"flip-grid\" class=\"flip-grid\" style=\"display: flex;\">\n<div data-type=\"flip-grid-column\" class=\"flip-grid-column\" data-width=\"25.2\" style=\"position: relative; padding: 8px; width: 25.2%;\">\n<div class=\"flip-grid-column-inner\"><p>\u53D1\u5BB6\u53F2\u6EF4\u6F0F\u5496\u5561\u5C31\u662F\u90A3\u4EFD\u72EC\u5B88\u7A7A\u623F\u653E\u5047\u554A sd \u5361\u96F7\u950B\u7CBE\u795E\u5927\u8054\u8003\u653E\u5047\u554A\u4F46\u662F\u6D6A\u8D39\u653E\u5047\u5361\u7684\u79C1\u4EBA\u98DE\u673A\u53EF\u80FD\u5565\u5730\u65B9\u5C31\u662F\u4E86\u5FEB\u9012\u8D39\u5C31\u662F\u90A3\u5BA2\u670D\u53D1\u4E0A\u6765\u7684\u5496\u5561\u53EB\u5565\u4E86\u7684\u770B\u6CD5\u5C31\u5F00\u59CB\u5927\u6DA6\u53D1\u5065\u5EB7\u5565\u7684\u53D1\u94FE\u63A5\u6C99\u53D1\u90A3\u662F\u5730\u65B9\u53D1\u70E7\u7684\u51CF\u80A5\u5F00\u59CB\u4F60\u7684\u623F\u95F4\u6740\u4EBA\u72AF\u770B\u89C1\u5565\u4E86\u5F00\u623F\u95F4\u5361\u6B7B\u4E86\u653E\u5047\u5565\u4E86</p></div></div>\n<div data-type=\"flip-grid-column\" class=\"flip-grid-column\" data-width=\"74.8\" style=\"position: relative; padding: 8px; width: 74.8%;\">\n<div class=\"flip-grid-column-inner\"><p>\u653E\u5047\u5565\u4F60\u7684\u770B\u6CD5\u5C31\u662F\u90A3\u80AF\u5B9A\u89E3\u5C01\u4E86\u5237\u5361\u7684\u5C31\u5206\u5F00\u4E86\u715E\u98CE\u666F\u53EF\u80FD\u6C99\u53D1\u4ECA\u5E74\u662F\u7684\u6D6A\u8D39\u7A7A\u95F4\u6536\u5230\u90A3\u5C31\u6CD5\u62C9\u7B2C\u4F1A\u8BA1\u5206\u5F55\u6DF1\u5496\u5561\u5C31\u662F\u4F60\u7684\u653E\u5047\u4E86\u5237\u5361\u53D1\u5BB6\u53F2\u4F10\u5730\u90A3\u975E\u4ECA\u5E74\u5F00\u59CB\u653E\u5047\u4E86\u770B\u7535\u89C6\u5267\u83F2\u5C3C\u514B\u65AF\u5927\u59D0\u592B\u5E74\u5361\u662F fsa.f\uFF0C\u624B\u673A\u8F90\u5C04\u90FD\u653E\u5047\u4E86\u5361\u8428\u5E1D\u89E3\u5C01\u4E86\u6C99\u53D1\u5C31\u662F\u90A3\u5BA2\u670D\u5C31\u662F\u90A3\u5730\u65B9\u5C31\u554A\u8212\u670D\u4E86\u5565\u53D1\u70E7\u90A3\u5757\u5730\u65B9\u5065\u5EB7\u90A3\u662F\u653E\u5047\u554A\u4F60</p></div></div></div>\n<table style=\"min-width: 400px;\"><colgroup><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\">\n <table style=\"min-width: 200px;\"><colgroup><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr></tbody></table>\n</td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr></tbody></table>\n<ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u653E\u5047\u6740\u4EBA\u7684\u65B9\u5F0F\u963F\u51E1\u8FBE</p></li><li><p>\u53D1\u70E7\u5927\u6DA6\u53D1\u770B\u89C1</p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u53D1\u5C31\u7B97\u4E86\u5FEB\u9012\u8D39</p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u653E\u5047\u554A\u4F46\u662F\u4F60\u770B\u653E\u5047\u554A\u867D\u7136\u653E</p></li></ol></li></ol></li></ol>\n<ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u5BB6\u53F2\u4F60\u7684\u770B\u6CD5</p></li><li><p>\u53D1\u751F\u7684\u6FC0\u70C8\u53CD\u6297\u5565\u7684\u5C31\u53D1\u7684\u662F\u653E\u5047\u4E86</p><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u70E7\u7684\u798F\u5229\u80AF\u5B9A\u6492\u9152\u75AF\u90A3\u53EF\u662F\u6253\u98DE\u673A\u554A\u662F\u4F60\u7684\u5BA2\u670D\u5C31\u662F\u5927\u6DA6\u53D1</p></li><li><p>\u53D1\u751F\u7684\u6D6A\u8D39\u7A7A\u95F4\u5565\u7684\u5357\u65B9\u5DE8\u517D\u9F99\u7684\u770B\u6CD5\u9759\u5B89\u5BFA\u5E97\u7406\u53D1\u5E08\u89E3\u653E\u4E1C\u8DEF</p><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u751F\u7684\u53D1\u53D1\u987A\u4E30\u90A3\u53EF\u662F\u6253\u98DE\u673A\u554A\u867D\u7136\u5BA2\u670D</p></li></ul></li></ul></li></ul>\n<ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u5565\u7684</p></div></li><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"true\"><label><input type=\"checkbox\" checked=\"checked\"><span></span></label><div><p>\u53D1\u5565\u5446\u4F60</p><ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u5927\u4E86</p><ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u7684\u65F6\u95F4\u6765\u770B</p></div></li></ul></div></li></ul></div></li></ul>\n<pre data-title=\"\u5B89\u88C5\u76EE\u5F55\"><code>var a = 1;</code></pre>\n<p><img src=\"https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg\" width=\"100\"></p>\n<p><img src=\"https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg\" width=\"100\"></p>\n<h6 id=\"4b8d8c4e-29dc-4674-928b-b9ded0e363ae\" data-toc-id=\"4b8d8c4e-29dc-4674-928b-b9ded0e363ae\"><span data-name=\"watch\" data-type=\"emoji\">\u231A</span> \u8868\u683C\u64CD\u4F5C</h6>\n<table><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u94FE\u63A5</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u590D\u6742\u6587\u672C</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u56FE\u7247</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u9644\u4EF6</p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><a target=\"_blank\" class=\"MuiBox-root css-1ivg9gg\" type=\"icon\" rel=\"noopener noreferrer\" title=\"\u70B9\u51FB\u6B64\u5904\u8DF3\u8F6C\" href=\"http://localhost:8000/components/editor\">\u70B9\u51FB\u6B64\u5904\u8DF3\u8F6C</a></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><code>\u77E5</code><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B</span><sup>\u5386</sup><sub>\u53F2</sub><u>\u52A8</u><s>\u5927</s><span style=\"background-color: rgb(172, 84, 84);\">\u501F</span><mark>\u7B54</mark></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><img src=\"https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg\" width=\"100\"></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA.txt\" data-size=\"18.27 KB\"></span></p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" controls=\"true\" width=\"75%\"></video></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p><audio src=\"http://vjs.zencdn.net/v/oceans.mp4\" controls=\"true\"></audio></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p></td></tr></tbody></table>\n<p><img src=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" width=\"100\"></p>\n<h6 id=\"a025f782-910f-4f17-9d0b-8f31f9cde175\" data-toc-id=\"a025f782-910f-4f17-9d0b-8f31f9cde175\"><span data-name=\"page_facing_up\" data-type=\"emoji\">\uD83D\uDCC4</span> \u6587\u672C\u5904\u7406</h6>\n<p>PandaWiki \u662F\u4E00\u6B3E AI \u5927\u6A21<code>\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D</code>\u5EFA\u7CFB\u7EDF\uFF0CF<strong>AQ \u3001 \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI </strong>\u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u501F<span style=\"color: rgb(90, 141, 218);\">\u52A9\u5927\u6A21\u578B\u7684</span><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B\u91CF\u4E3A\u4F60\u63D0</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B AI \u521B</span>\u4F5C\u80FD\u529B\u3002PandaWiki \u662F<u>\u4E00\u6B3E AI \u5927\u6A21\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D\u5EFA\u7CFB\u7EDF\uFF0C\u5E2E</u>\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u667A\u80FD\u5316\u7684 <s><u>\u4EA7\u54C1\u6587\u6863\u3001\u6280\u672F</u></s>\u6587\u6863\u3001FAQ \u3001<s> \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684</s>\u529B\u91CF\u7CFB\u7EDF \uFF0C<span style=\"background-color: rgb(172, 84, 84);\">\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE</span>\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u7684\u529B\u91CF\u4E3A<mark>\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001</mark> AI \u641C\u7D22\u3002</p>\n<a target=\"_blank\" type=\"block\" href=\"http://localhost:8000/components/editor\" title=\"\u770B\u98CE\u666F\">\u770B\u98CE\u666F</a>\n<h6>\uD83D\uDCCE \u9644\u4EF6</h6>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA\uFF1F\u8C01\u662F\u6211\u4EEC\u7684\u670B\u53CB\uFF1F\u8FD9\u4E2A\u95EE\u9898\u662F\u9769\u547D\u7684\u9996\u8981\u95EE\u9898\u3002\u4E2D\u56FD\u8FC7\u53BB\u4E00\u5207\u9769\u547D\u6597\u4E89\u6210.txt\" data-size=\"18.27 KB\"></div>\n<p>\u884C\u5185\u9644\u4EF6\uFF1A<span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"font_4856251_qynqqohzdp.js\" data-size=\"412.34 KB\"></span><span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u96F7\u6C60\u9879\u76EE\u8BBE\u8BA1\u65B9\u6848.docx\" data-size=\"635.74 KB\"></span></p>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"b0f4a3e0-639f-4c09-ab33-ea9417939f87.tiff\" data-size=\"3.03 MB\"></div>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u957F\u4EAD\u79D1\u6280\u516C\u53F8\u4ECB\u7ECDPPT-25.07.007_\u526F\u672C.pptx\" data-size=\"40.18 MB\"></div>\n<h6><span data-name=\"loudspeaker\" data-type=\"emoji\">\uD83D\uDCE2</span> \u97F3\u9891</h6>\n<audio src=\"http://vjs.zencdn.net/v/oceans.mp4\" controls=\"true\"></audio>\n<h6 id=\"1739ed5e-f03c-4c2f-b763-37505601c935\" data-toc-id=\"1739ed5e-f03c-4c2f-b763-37505601c935\"><span data-name=\"video_camera\" data-type=\"emoji\">\uD83D\uDCF9</span> \u89C6\u9891</h6>\n<video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" controls=\"true\" width=\"400\" data-align=\"center\"></video>\n<h6 id=\"746ea233-0e30-44a6-849a-090202217299\" data-toc-id=\"746ea233-0e30-44a6-849a-090202217299\">\u26A0\uFE0F \u8B66\u544A\u5757</h6>\n<div data-id=\"alert_5ysakwbhvqv\" data-variant=\"warning\" data-type=\"icon\" data-node=\"alert\"><p>\u6B64\u65F6\u8FD9\u662F\u4E00\u4E2A\u8B66\u544A\u5757\u3002</p></div>\n<h6 id=\"ebb64062-9efb-4de8-887f-7f8b7f9e54ca\" data-toc-id=\"ebb64062-9efb-4de8-887f-7f8b7f9e54ca\"><span data-name=\"bar_chart\" data-type=\"emoji\">\uD83D\uDCCA</span> \u6D41\u7A0B\u56FE\u64CD\u4F5C</h6>\n<div data-type=\"flow\" data-code=\"mindmap\n root((mindmap))\n Origins\n Long history\n ::icon(fa fa-book)\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness<br/>and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid\" data-width=\"246px\"></div>\n";
|
|
11
|
+
var DEFAULT_HTML_CONTENT = "<p></p>\n<p>PandaWiki \u662F\u4E00\u6B3E AI \u5927\u6A21<code>\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D</code>\u5EFA\u7CFB\u7EDF\uFF0CF<strong>AQ \u3001 \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI </strong>\u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u501F<span style=\"color: rgb(90, 141, 218);\">\u52A9\u5927\u6A21\u578B\u7684</span><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B\u91CF\u4E3A\u4F60\u63D0</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B AI \u521B</span>\u4F5C\u80FD\u529B\u3002PandaWiki \u662F<u>\u4E00\u6B3E AI \u5927\u6A21\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D\u5EFA\u7CFB\u7EDF\uFF0C\u5E2E</u>\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u667A\u80FD\u5316\u7684 <s><u>\u4EA7\u54C1\u6587\u6863\u3001\u6280\u672F</u></s>\u6587\u6863\u3001FAQ \u3001<s> \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684</s>\u529B\u91CF\u7CFB\u7EDF \uFF0C<span style=\"background-color: rgb(172, 84, 84);\">\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE</span>\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u7684\u529B\u91CF\u4E3A<mark>\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001</mark> AI \u641C\u7D22\u3002</p>\n<table style=\"--default-cell-min-width: 100px; min-width: 700px;\"><colgroup><col><col><col><col><col><col><col></colgroup><tbody><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>1</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>2</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>3</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>4</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>5</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>6</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>7</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>q</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>w</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>e</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>r</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>t</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>y</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>u</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>a</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>s</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>d</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>f</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>g</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>h</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>j</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>z</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>x</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>c</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>v</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>b</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>n</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>m</p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>i</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>o</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>p</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>k</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>l</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>8</p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" style=\"\"><p>9</p></td></tr></tbody></table>\n<hr />\n<div data-type=\"flip-grid\" class=\"flip-grid\"><div data-type=\"flip-grid-column\" data-width=\"42.99\" style=\"width: 42.99%;\"><p><span>PandaWiki \u662F\u4E00\u6B3E AI \u5927\u6A21<code>\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D</code>\u5EFA\u7CFB\u7EDF\uFF0CF<strong>AQ \u3001 \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI </strong>\u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u501F</span><span style=\"color: rgb(90, 141, 218);\">\u52A9\u5927\u6A21\u578B\u7684</span><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B\u91CF\u4E3A\u4F60\u63D0</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B AI \u521B</span><span>\u4F5C\u80FD\u529B\u3002PandaWiki \u662F<u>\u4E00\u6B3E AI \u5927\u6A21\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D\u5EFA\u7CFB\u7EDF\uFF0C\u5E2E</u>\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u667A\u80FD\u5316\u7684 <s><u>\u4EA7\u54C1\u6587\u6863\u3001\u6280\u672F</u></s>\u6587\u6863\u3001FAQ \u3001<s> \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684</s>\u529B\u91CF\u7CFB\u7EDF \uFF0C</span><span style=\"background-color: rgb(172, 84, 84);\">\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE</span><span>\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u7684\u529B\u91CF\u4E3A<mark>\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001</mark> AI \u641C\u7D22\u3002</span></p></div><div data-type=\"flip-grid-column\" data-width=\"38.92\" style=\"width: 38.92%;\"><pre><code>var a = 1;\nvar b = 2;\n\nfunction sum(a, b) {\n return a + b\n}</code></pre></div><div data-type=\"flip-grid-column\" data-width=\"18.09\" style=\"width: 18.09%;\"><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u653E\u5047\u554A\u4F46\u662F\u53EF</p></li><li><p>\u653E\u7684\u65F6\u95F4\u653E\u5047</p></li><li><p>\u53EF\u53C2\u8003</p></li><li><p>\u987A\u4E30\u6253\u5361\u5566</p></li></ul></div></div>\n<div data-type=\"flip-grid\" class=\"flip-grid\" style=\"display: flex;\">\n<div data-type=\"flip-grid-column\" class=\"flip-grid-column\" data-width=\"25.2\" style=\"position: relative; padding: 8px; width: 25.2%;\">\n<div class=\"flip-grid-column-inner\"><p>\u53D1\u5BB6\u53F2\u6EF4\u6F0F\u5496\u5561\u5C31\u662F\u90A3\u4EFD\u72EC\u5B88\u7A7A\u623F\u653E\u5047\u554A sd \u5361\u96F7\u950B\u7CBE\u795E\u5927\u8054\u8003\u653E\u5047\u554A\u4F46\u662F\u6D6A\u8D39\u653E\u5047\u5361\u7684\u79C1\u4EBA\u98DE\u673A\u53EF\u80FD\u5565\u5730\u65B9\u5C31\u662F\u4E86\u5FEB\u9012\u8D39\u5C31\u662F\u90A3\u5BA2\u670D\u53D1\u4E0A\u6765\u7684\u5496\u5561\u53EB\u5565\u4E86\u7684\u770B\u6CD5\u5C31\u5F00\u59CB\u5927\u6DA6\u53D1\u5065\u5EB7\u5565\u7684\u53D1\u94FE\u63A5\u6C99\u53D1\u90A3\u662F\u5730\u65B9\u53D1\u70E7\u7684\u51CF\u80A5\u5F00\u59CB\u4F60\u7684\u623F\u95F4\u6740\u4EBA\u72AF\u770B\u89C1\u5565\u4E86\u5F00\u623F\u95F4\u5361\u6B7B\u4E86\u653E\u5047\u5565\u4E86</p></div></div>\n<div data-type=\"flip-grid-column\" class=\"flip-grid-column\" data-width=\"74.8\" style=\"position: relative; padding: 8px; width: 74.8%;\">\n<div class=\"flip-grid-column-inner\"><p>\u653E\u5047\u5565\u4F60\u7684\u770B\u6CD5\u5C31\u662F\u90A3\u80AF\u5B9A\u89E3\u5C01\u4E86\u5237\u5361\u7684\u5C31\u5206\u5F00\u4E86\u715E\u98CE\u666F\u53EF\u80FD\u6C99\u53D1\u4ECA\u5E74\u662F\u7684\u6D6A\u8D39\u7A7A\u95F4\u6536\u5230\u90A3\u5C31\u6CD5\u62C9\u7B2C\u4F1A\u8BA1\u5206\u5F55\u6DF1\u5496\u5561\u5C31\u662F\u4F60\u7684\u653E\u5047\u4E86\u5237\u5361\u53D1\u5BB6\u53F2\u4F10\u5730\u90A3\u975E\u4ECA\u5E74\u5F00\u59CB\u653E\u5047\u4E86\u770B\u7535\u89C6\u5267\u83F2\u5C3C\u514B\u65AF\u5927\u59D0\u592B\u5E74\u5361\u662F fsa.f\uFF0C\u624B\u673A\u8F90\u5C04\u90FD\u653E\u5047\u4E86\u5361\u8428\u5E1D\u89E3\u5C01\u4E86\u6C99\u53D1\u5C31\u662F\u90A3\u5BA2\u670D\u5C31\u662F\u90A3\u5730\u65B9\u5C31\u554A\u8212\u670D\u4E86\u5565\u53D1\u70E7\u90A3\u5757\u5730\u65B9\u5065\u5EB7\u90A3\u662F\u653E\u5047\u554A\u4F60</p></div></div></div>\n<table style=\"min-width: 400px;\"><colgroup><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\">\n <table style=\"min-width: 200px;\"><colgroup><col style=\"min-width: 100px;\"><col style=\"min-width: 100px;\"></colgroup><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr></tbody></table>\n</td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td><td colspan=\"1\" rowspan=\"1\" style=\"\"><p></p></td></tr></tbody></table>\n<ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u653E\u5047\u6740\u4EBA\u7684\u65B9\u5F0F\u963F\u51E1\u8FBE</p></li><li><p>\u53D1\u70E7\u5927\u6DA6\u53D1\u770B\u89C1</p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u53D1\u5C31\u7B97\u4E86\u5FEB\u9012\u8D39</p><ol class=\"ordered-list\" data-type=\"orderedList\"><li><p>\u653E\u5047\u554A\u4F46\u662F\u4F60\u770B\u653E\u5047\u554A\u867D\u7136\u653E</p></li></ol></li></ol></li></ol>\n<ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u5BB6\u53F2\u4F60\u7684\u770B\u6CD5</p></li><li><p>\u53D1\u751F\u7684\u6FC0\u70C8\u53CD\u6297\u5565\u7684\u5C31\u53D1\u7684\u662F\u653E\u5047\u4E86</p><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u70E7\u7684\u798F\u5229\u80AF\u5B9A\u6492\u9152\u75AF\u90A3\u53EF\u662F\u6253\u98DE\u673A\u554A\u662F\u4F60\u7684\u5BA2\u670D\u5C31\u662F\u5927\u6DA6\u53D1</p></li><li><p>\u53D1\u751F\u7684\u6D6A\u8D39\u7A7A\u95F4\u5565\u7684\u5357\u65B9\u5DE8\u517D\u9F99\u7684\u770B\u6CD5\u9759\u5B89\u5BFA\u5E97\u7406\u53D1\u5E08\u89E3\u653E\u4E1C\u8DEF</p><ul class=\"bullet-list\" data-type=\"bulletList\"><li><p>\u53D1\u751F\u7684\u53D1\u53D1\u987A\u4E30\u90A3\u53EF\u662F\u6253\u98DE\u673A\u554A\u867D\u7136\u5BA2\u670D</p></li></ul></li></ul></li></ul>\n<ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u5565\u7684</p></div></li><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"true\"><label><input type=\"checkbox\" checked=\"checked\"><span></span></label><div><p>\u53D1\u5565\u5446\u4F60</p><ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u5927\u4E86</p><ul data-type=\"taskList\"><li class=\"task-item\" data-type=\"taskItem\" data-checked=\"false\"><label><input type=\"checkbox\"><span></span></label><div><p>\u53D1\u7684\u65F6\u95F4\u6765\u770B</p></div></li></ul></div></li></ul></div></li></ul>\n<pre data-title=\"\u5B89\u88C5\u76EE\u5F55\"><code>var a = 1;</code></pre>\n<p><img src=\"https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg\" width=\"100\"></p>\n<p><img src=\"https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg\" width=\"100\"></p>\n<h6 id=\"4b8d8c4e-29dc-4674-928b-b9ded0e363ae\" data-toc-id=\"4b8d8c4e-29dc-4674-928b-b9ded0e363ae\"><span data-name=\"watch\" data-type=\"emoji\">\u231A</span> \u8868\u683C\u64CD\u4F5C</h6>\n<table><tbody><tr class=\"table-row\"><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u94FE\u63A5</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u590D\u6742\u6587\u672C</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u56FE\u7247</p></th><th class=\"table-header\" colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p>\u9644\u4EF6</p></th></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><a target=\"_blank\" class=\"MuiBox-root css-1ivg9gg\" type=\"icon\" rel=\"noopener noreferrer\" title=\"\u70B9\u51FB\u6B64\u5904\u8DF3\u8F6C\" href=\"http://localhost:8000/components/editor\">\u70B9\u51FB\u6B64\u5904\u8DF3\u8F6C</a></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><code>\u77E5</code><span style=\"background-color: rgb(255, 204, 188); color: rgb(90, 141, 218);\">\u529B</span><span style=\"color: rgb(90, 141, 218);\">\u4F9B</span><sup>\u5386</sup><sub>\u53F2</sub><u>\u52A8</u><s>\u5927</s><span style=\"background-color: rgb(172, 84, 84);\">\u501F</span><mark>\u7B54</mark></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><img src=\"https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg\" width=\"100\"></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" data-vertical-align=\"middle\" style=\"text-align: center; vertical-align: middle;\"><p><span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA.txt\" data-size=\"18.27 KB\"></span></p></td></tr><tr class=\"table-row\"><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" controls=\"true\" width=\"75%\"></video></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p><audio src=\"http://vjs.zencdn.net/v/oceans.mp4\" controls=\"true\"></audio></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p></td><td colspan=\"1\" rowspan=\"1\" data-background-color=\"\" data-text-align=\"center\" style=\"text-align: center;\"><p></p></td></tr></tbody></table>\n<p><img src=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" width=\"100\"></p>\n<h6 id=\"a025f782-910f-4f17-9d0b-8f31f9cde175\" data-toc-id=\"a025f782-910f-4f17-9d0b-8f31f9cde175\"><span data-name=\"page_facing_up\" data-type=\"emoji\">\uD83D\uDCC4</span> \u6587\u672C\u5904\u7406</h6>\n<a target=\"_blank\" type=\"block\" href=\"http://localhost:8000/components/editor\" title=\"\u770B\u98CE\u666F\">\u770B\u98CE\u666F</a>\n<h6>\uD83D\uDCCE \u9644\u4EF6</h6>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA\uFF1F\u8C01\u662F\u6211\u4EEC\u7684\u670B\u53CB\uFF1F\u8FD9\u4E2A\u95EE\u9898\u662F\u9769\u547D\u7684\u9996\u8981\u95EE\u9898\u3002\u4E2D\u56FD\u8FC7\u53BB\u4E00\u5207\u9769\u547D\u6597\u4E89\u6210.txt\" data-size=\"18.27 KB\"></div>\n<p>\u884C\u5185\u9644\u4EF6\uFF1A<span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"font_4856251_qynqqohzdp.js\" data-size=\"412.34 KB\"></span><span data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u96F7\u6C60\u9879\u76EE\u8BBE\u8BA1\u65B9\u6848.docx\" data-size=\"635.74 KB\"></span></p>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"b0f4a3e0-639f-4c09-ab33-ea9417939f87.tiff\" data-size=\"3.03 MB\"></div>\n<div data-tag=\"attachment\" url=\"\" title=\"\" size=\"0\" data-url=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" data-title=\"\u957F\u4EAD\u79D1\u6280\u516C\u53F8\u4ECB\u7ECDPPT-25.07.007_\u526F\u672C.pptx\" data-size=\"40.18 MB\"></div>\n<h6><span data-name=\"loudspeaker\" data-type=\"emoji\">\uD83D\uDCE2</span> \u97F3\u9891</h6>\n<audio src=\"http://vjs.zencdn.net/v/oceans.mp4\" controls=\"true\"></audio>\n<h6 id=\"1739ed5e-f03c-4c2f-b763-37505601c935\" data-toc-id=\"1739ed5e-f03c-4c2f-b763-37505601c935\"><span data-name=\"video_camera\" data-type=\"emoji\">\uD83D\uDCF9</span> \u89C6\u9891</h6>\n<video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" controls=\"true\" width=\"400\" data-align=\"center\"></video>\n<h6 id=\"746ea233-0e30-44a6-849a-090202217299\" data-toc-id=\"746ea233-0e30-44a6-849a-090202217299\">\u26A0\uFE0F \u8B66\u544A\u5757</h6>\n<div data-id=\"alert_5ysakwbhvqv\" data-variant=\"warning\" data-type=\"icon\" data-node=\"alert\"><p>\u6B64\u65F6\u8FD9\u662F\u4E00\u4E2A\u8B66\u544A\u5757\u3002</p></div>\n<h6 id=\"ebb64062-9efb-4de8-887f-7f8b7f9e54ca\" data-toc-id=\"ebb64062-9efb-4de8-887f-7f8b7f9e54ca\"><span data-name=\"bar_chart\" data-type=\"emoji\">\uD83D\uDCCA</span> \u6D41\u7A0B\u56FE\u64CD\u4F5C</h6>\n<div data-type=\"flow\" data-code=\"mindmap\n root((mindmap))\n Origins\n Long history\n ::icon(fa fa-book)\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness<br/>and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid\" data-width=\"246px\"></div>\n";
|
|
12
12
|
var DEFAULT_MARKDOWN_CONTENT = "###### :page_facing_up: \u6587\u672C\u5904\u7406\n\nPandaWiki \u662F\u4E00\u6B3E AI \u5927\u6A21`\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D`\u5EFA\u7CFB\u7EDF\uFF0CF**AQ \u3001 \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI **\u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C\u80FD\u529B\u3002PandaWiki \u662F++\u4E00\u6B3E AI \u5927\u6A21\u578B\u9A71\u52A8\u7684\u5F00\u6E90\u77E5\u8BC6\u5E93\u642D\u5EFA\u7CFB\u7EDF\uFF0C\u5E2E++\u52A9\u4F60\u5FEB\u901F\u6784\u5EFA\u667A\u80FD\u5316\u7684 ++~~\u4EA7\u54C1\u6587\u6863\u3001\u6280\u672F~~++\u6587\u6863\u3001FAQ \u3001~~ \u535A\u5BA2\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684~~\u529B\u91CF\u7CFB\u7EDF \uFF0C\u501F\u52A9\u5927\u6A21\u578B\u7684\u529B\u91CF\u4E3A\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001 AI \u641C\u7D22 \u7B49\u80FD\u529B\u3002\u7684\u529B\u91CF\u4E3A==\u4F60\u63D0\u4F9B AI \u521B\u4F5C \u3001 AI \u95EE\u7B54 \u3001== AI \u641C\u7D22\u3002\n\n###### :video_camera: \u89C6\u9891\n\n<video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" width=\"400\" controls ></video>\n\n###### \u26A0\uFE0F \u8B66\u544A\u5757\n\n:::alert {#alert_5ysakwbhvqv indent=\"0\" variant=\"warning\" type=\"icon\"}\n\n\u6B64\u65F6\u8FD9\u662F\u4E00\u4E2A\u8B66\u544A\u5757\u3002\n\n:::\n\n###### :bar_chart: \u6D41\u7A0B\u56FE\u64CD\u4F5C\n\n```mermaid\nmindmap\n root((mindmap))\n Origins\n Long history\n ::icon(fa fa-book)\n Popularisation\n British popular psychology author Tony Buzan\n Research\n On effectiveness<br/>and features\n On Automatic creation\n Uses\n Creative techniques\n Strategic planning\n Argument mapping\n Tools\n Pen and paper\n Mermaid\n```\n\n###### :watch: \u8868\u683C\u64CD\u4F5C\n\n\n| \u94FE\u63A5 | \u590D\u6742\u6587\u672C | \u56FE\u7247 | \u9644\u4EF6 |\n| ------------------------------------------------------------------------------------------- | --------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| [\u70B9\u51FB\u6B64\u5904\u8DF3\u8F6C](http://localhost:8000/components/editor) | `\u77E5`\u529B\u4F9B^\u5386^~\u53F2~++\u52A8++~~\u5927~~\u501F==\u7B54== |  | <a href=\"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg\" target=\"_blank\" download=\"\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA.txt\">\u8C01\u662F\u6211\u4EEC\u7684\u654C\u4EBA.txt</a> |\n| <video src=\"https://media.w3.org/2010/05/sintel/trailer.mp4\" width=\"75%\" controls ></video> | \x1F | | |\n\n\n";
|
|
13
13
|
var Reader = function Reader() {
|
|
14
14
|
// @ts-ignore
|
|
@@ -137,7 +137,7 @@ var Reader = function Reader() {
|
|
|
137
137
|
}();
|
|
138
138
|
var _useTiptap = useTiptap({
|
|
139
139
|
editable: EDITABLE,
|
|
140
|
-
content:
|
|
140
|
+
content: content,
|
|
141
141
|
contentType: DEFAULT_CONTENT_TYPE,
|
|
142
142
|
exclude: ['invisibleCharacters'],
|
|
143
143
|
onError: handleError,
|
package/dist/asset/css/index.css
CHANGED
|
@@ -115,7 +115,10 @@
|
|
|
115
115
|
.tiptap.ProseMirror .react-renderer.node-codeBlock,
|
|
116
116
|
.tiptap.ProseMirror .react-renderer.node-blockLink,
|
|
117
117
|
.tiptap.ProseMirror .react-renderer.node-flipGrid,
|
|
118
|
+
.tiptap.ProseMirror .react-renderer.node-audio,
|
|
119
|
+
.tiptap.ProseMirror .react-renderer.node-video,
|
|
118
120
|
.tiptap.ProseMirror .react-renderer.node-flow,
|
|
121
|
+
.tiptap.ProseMirror .react-renderer.node-blockMath,
|
|
119
122
|
.tiptap.ProseMirror .react-renderer.node-blockAttachment {
|
|
120
123
|
display: block;
|
|
121
124
|
margin: 1rem 0;
|
|
@@ -126,27 +129,28 @@
|
|
|
126
129
|
margin-left: 0;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
.tiptap.ProseMirror .audio-wrapper,
|
|
130
|
-
.tiptap.ProseMirror .video-wrapper,
|
|
131
|
-
.tiptap.ProseMirror .image-wrapper {
|
|
132
|
-
line-height: 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
132
|
.tiptap.ProseMirror .react-renderer.node-iframe,
|
|
136
|
-
.tiptap.ProseMirror .
|
|
137
|
-
.tiptap.ProseMirror .
|
|
133
|
+
.tiptap.ProseMirror .react-renderer.node-image,
|
|
134
|
+
.tiptap.ProseMirror .react-renderer.node-audio,
|
|
135
|
+
.tiptap.ProseMirror .react-renderer.node-video,
|
|
136
|
+
.tiptap.ProseMirror .react-renderer.node-blockAttachment,
|
|
137
|
+
.tiptap.ProseMirror .react-renderer.node-inlineAttachment,
|
|
138
|
+
.tiptap.ProseMirror .react-renderer.node-blockLink,
|
|
139
|
+
.tiptap.ProseMirror .react-renderer.node-inlineLink,
|
|
140
|
+
.tiptap.ProseMirror .react-renderer.node-blockMath,
|
|
141
|
+
.tiptap.ProseMirror .react-renderer.node-inlineMath {
|
|
138
142
|
box-sizing: border-box;
|
|
139
143
|
line-height: 1;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
.tiptap.ProseMirror .image-wrapper {
|
|
143
|
-
display: inline-block;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
146
|
.tiptap.ProseMirror .image-wrapper img {
|
|
147
147
|
line-height: 0;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
.tiptap.ProseMirror .image-wrapper {
|
|
151
|
+
display: inline-block;
|
|
152
|
+
}
|
|
153
|
+
|
|
150
154
|
.tiptap.ProseMirror .codeblock-wrapper.ProseMirror-selectednode>pre,
|
|
151
155
|
.tiptap.ProseMirror .audio-wrapper.ProseMirror-selectednode>div,
|
|
152
156
|
.tiptap.ProseMirror .video-wrapper.ProseMirror-selectednode>div,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface TooltipInputPopoverProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
anchorEl: HTMLElement | null;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
editor: Editor;
|
|
8
|
+
currentTooltip?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const TooltipInputPopover: React.FC<TooltipInputPopoverProps>;
|
|
11
|
+
export default TooltipInputPopover;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { FloatingPopover } from "../FloatingPopover";
|
|
8
|
+
import { Box, Button, Stack, TextField } from "@mui/material";
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
var TooltipInputPopover = function TooltipInputPopover(_ref) {
|
|
11
|
+
var open = _ref.open,
|
|
12
|
+
anchorEl = _ref.anchorEl,
|
|
13
|
+
onClose = _ref.onClose,
|
|
14
|
+
editor = _ref.editor,
|
|
15
|
+
_ref$currentTooltip = _ref.currentTooltip,
|
|
16
|
+
currentTooltip = _ref$currentTooltip === void 0 ? '' : _ref$currentTooltip;
|
|
17
|
+
var _useState = useState(currentTooltip),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
tooltipText = _useState2[0],
|
|
20
|
+
setTooltipText = _useState2[1];
|
|
21
|
+
var handleConfirm = function handleConfirm() {
|
|
22
|
+
if (tooltipText.trim()) {
|
|
23
|
+
editor.chain().focus().setTooltip(tooltipText.trim()).run();
|
|
24
|
+
} else {
|
|
25
|
+
editor.chain().focus().unsetTooltip().run();
|
|
26
|
+
}
|
|
27
|
+
onClose();
|
|
28
|
+
};
|
|
29
|
+
var handleCancel = function handleCancel() {
|
|
30
|
+
setTooltipText(currentTooltip);
|
|
31
|
+
onClose();
|
|
32
|
+
};
|
|
33
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
34
|
+
if (event.key === 'Enter') {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
handleConfirm();
|
|
37
|
+
} else if (event.key === 'Escape') {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
handleCancel();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
43
|
+
open: open,
|
|
44
|
+
anchorEl: anchorEl,
|
|
45
|
+
onClose: handleCancel,
|
|
46
|
+
placement: "bottom"
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48
|
+
gap: 2,
|
|
49
|
+
sx: {
|
|
50
|
+
p: 2,
|
|
51
|
+
width: 350
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement(TextField, {
|
|
54
|
+
fullWidth: true,
|
|
55
|
+
size: "small",
|
|
56
|
+
value: tooltipText,
|
|
57
|
+
onChange: function onChange(e) {
|
|
58
|
+
return setTooltipText(e.target.value);
|
|
59
|
+
},
|
|
60
|
+
placeholder: "\u8F93\u5165\u9F20\u6807\u60AC\u505C\u65F6\u663E\u793A\u7684\u63D0\u793A\u6587\u672C",
|
|
61
|
+
required: true,
|
|
62
|
+
error: tooltipText.length > 0 && !tooltipText.trim(),
|
|
63
|
+
helperText: tooltipText.length > 0 && !tooltipText.trim() ? "请输入有效的提示文本" : ""
|
|
64
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
65
|
+
sx: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
gap: 1,
|
|
68
|
+
justifyContent: 'flex-end'
|
|
69
|
+
}
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
71
|
+
size: "small",
|
|
72
|
+
onClick: handleCancel
|
|
73
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
74
|
+
size: "small",
|
|
75
|
+
variant: "contained",
|
|
76
|
+
onClick: handleConfirm,
|
|
77
|
+
disabled: !tooltipText.trim() && !currentTooltip
|
|
78
|
+
}, tooltipText.trim() ? '应用' : '移除'))));
|
|
79
|
+
};
|
|
80
|
+
export default TooltipInputPopover;
|
|
@@ -1,46 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { BoldIcon, CodeLineIcon, EraserLineIcon, ItalicIcon, MarkPenLineIcon, StrikethroughIcon, TooltipLineIcon, UnderlineIcon } from "../Icons";
|
|
2
8
|
import { hasMarksInSelection } from "../../util";
|
|
3
9
|
import { Divider, Paper, Stack } from '@mui/material';
|
|
4
10
|
import { useEditorState } from '@tiptap/react';
|
|
5
11
|
import { BubbleMenu } from '@tiptap/react/menus';
|
|
6
|
-
import React from 'react';
|
|
12
|
+
import React, { useState } from 'react';
|
|
7
13
|
import { ToolbarItem } from "../Toolbar";
|
|
14
|
+
import TooltipInputPopover from "./TooltipInputPopover";
|
|
8
15
|
var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
9
16
|
var editor = _ref.editor,
|
|
10
17
|
more = _ref.more;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// theme.palette.success.main,
|
|
16
|
-
// theme.palette.warning.main,
|
|
17
|
-
// theme.palette.error.main,
|
|
18
|
-
// '#D8A47F',
|
|
19
|
-
// '#73B5F0',
|
|
20
|
-
// '#CDDFA0',
|
|
21
|
-
// theme.palette.text.primary,
|
|
22
|
-
// theme.palette.text.secondary,
|
|
23
|
-
// theme.palette.text.disabled,
|
|
24
|
-
// theme.palette.common.white,
|
|
25
|
-
// ]
|
|
26
|
-
|
|
27
|
-
// const THEME_TEXT_BG_COLOR = [
|
|
28
|
-
// '#e7bdff',
|
|
29
|
-
// '#FFE0B2',
|
|
30
|
-
// '#F8BBD0',
|
|
31
|
-
// '#FFCDD2',
|
|
32
|
-
// '#FFECB3',
|
|
33
|
-
// '#FFCCBC',
|
|
34
|
-
// '#B3E5FC',
|
|
35
|
-
// '#C8E6C9',
|
|
36
|
-
// '#B2EBF2',
|
|
37
|
-
// '#BBDEFB',
|
|
38
|
-
// '#DCEDC8',
|
|
39
|
-
// ]
|
|
40
|
-
|
|
18
|
+
var _useState = useState(null),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
tooltipAnchorEl = _useState2[0],
|
|
21
|
+
setTooltipAnchorEl = _useState2[1];
|
|
41
22
|
var _useEditorState = useEditorState({
|
|
42
23
|
editor: editor,
|
|
43
24
|
selector: function selector(ctx) {
|
|
25
|
+
var _ctx$editor$getAttrib;
|
|
44
26
|
return {
|
|
45
27
|
isBold: ctx.editor.isActive('bold'),
|
|
46
28
|
isItalic: ctx.editor.isActive('italic'),
|
|
@@ -48,9 +30,9 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
48
30
|
isUnderline: ctx.editor.isActive('underline'),
|
|
49
31
|
isCode: ctx.editor.isActive('code'),
|
|
50
32
|
isHighlight: ctx.editor.isActive('highlight'),
|
|
33
|
+
isTooltip: ctx.editor.isActive('tooltip'),
|
|
34
|
+
currentTooltip: ((_ctx$editor$getAttrib = ctx.editor.getAttributes('tooltip')) === null || _ctx$editor$getAttrib === void 0 ? void 0 : _ctx$editor$getAttrib.tooltip) || '',
|
|
51
35
|
hasAnyMarks: hasMarksInSelection(ctx.editor.state)
|
|
52
|
-
// isSuperscript: ctx.editor.isActive('superscript'),
|
|
53
|
-
// isSubscript: ctx.editor.isActive('subscript'),
|
|
54
36
|
};
|
|
55
37
|
}
|
|
56
38
|
}),
|
|
@@ -60,11 +42,13 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
60
42
|
isUnderline = _useEditorState.isUnderline,
|
|
61
43
|
isCode = _useEditorState.isCode,
|
|
62
44
|
isHighlight = _useEditorState.isHighlight,
|
|
45
|
+
isTooltip = _useEditorState.isTooltip,
|
|
46
|
+
currentTooltip = _useEditorState.currentTooltip,
|
|
63
47
|
hasAnyMarks = _useEditorState.hasAnyMarks;
|
|
64
48
|
if (editor && !editor.isEditable) {
|
|
65
49
|
return null;
|
|
66
50
|
}
|
|
67
|
-
return /*#__PURE__*/React.createElement(BubbleMenu, {
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BubbleMenu, {
|
|
68
52
|
editor: editor,
|
|
69
53
|
pluginKey: 'bubble-menu',
|
|
70
54
|
updateDelay: 750,
|
|
@@ -149,6 +133,17 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
149
133
|
return editor.chain().focus().toggleCode().run();
|
|
150
134
|
},
|
|
151
135
|
className: isCode ? "tool-active" : ""
|
|
136
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
137
|
+
icon: /*#__PURE__*/React.createElement(TooltipLineIcon, {
|
|
138
|
+
sx: {
|
|
139
|
+
fontSize: '1rem'
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
onClick: function onClick(event) {
|
|
143
|
+
return setTooltipAnchorEl(event.currentTarget);
|
|
144
|
+
},
|
|
145
|
+
className: isTooltip ? "tool-active" : "",
|
|
146
|
+
tip: "\u6DFB\u52A0\u63D0\u793A\u6587\u672C"
|
|
152
147
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
153
148
|
orientation: "vertical",
|
|
154
149
|
flexItem: true,
|
|
@@ -175,6 +170,14 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
175
170
|
icon: item.icon || /*#__PURE__*/React.createElement(React.Fragment, null),
|
|
176
171
|
onClick: item.onClick
|
|
177
172
|
});
|
|
178
|
-
}))))
|
|
173
|
+
})))), /*#__PURE__*/React.createElement(TooltipInputPopover, {
|
|
174
|
+
open: Boolean(tooltipAnchorEl),
|
|
175
|
+
anchorEl: tooltipAnchorEl,
|
|
176
|
+
onClose: function onClose() {
|
|
177
|
+
return setTooltipAnchorEl(null);
|
|
178
|
+
},
|
|
179
|
+
editor: editor,
|
|
180
|
+
currentTooltip: currentTooltip
|
|
181
|
+
}));
|
|
179
182
|
};
|
|
180
183
|
export default CustomBubbleMenu;
|
|
@@ -23,7 +23,7 @@ import { Box, Divider, Stack, Typography, useTheme } from '@mui/material';
|
|
|
23
23
|
import DragHandle from '@tiptap/extension-drag-handle-react';
|
|
24
24
|
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
25
25
|
import { NodeSelection } from '@tiptap/pm/state';
|
|
26
|
-
import React, { useCallback, useState } from 'react';
|
|
26
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
27
27
|
import { convertNodeAt, downloadFiles, filterResourcesByType, getAllResources, getShortcutKeyText, hasMarksInBlock } from "../../util";
|
|
28
28
|
import Menu from "../Menu";
|
|
29
29
|
import { ToolbarItem } from "../Toolbar";
|
|
@@ -196,6 +196,46 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
}, [current.pos, current.node]);
|
|
199
|
+
useEffect(function () {
|
|
200
|
+
if (!editor) return;
|
|
201
|
+
var handleUpdate = function handleUpdate() {
|
|
202
|
+
var state = editor.state;
|
|
203
|
+
var selection = state.selection;
|
|
204
|
+
|
|
205
|
+
// 获取当前光标位置的节点
|
|
206
|
+
var pos = selection.$head.pos;
|
|
207
|
+
var node = null;
|
|
208
|
+
|
|
209
|
+
// 向上查找最近的块级节点
|
|
210
|
+
for (var depth = selection.$head.depth; depth >= 0; depth--) {
|
|
211
|
+
var _currentNode = selection.$head.node(depth);
|
|
212
|
+
if (_currentNode && _currentNode.isBlock) {
|
|
213
|
+
node = _currentNode;
|
|
214
|
+
pos = selection.$head.before(depth + 1);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 如果没找到块级节点,使用根节点
|
|
220
|
+
if (!node) {
|
|
221
|
+
node = state.doc.firstChild;
|
|
222
|
+
pos = 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// 更新状态
|
|
226
|
+
if (node) {
|
|
227
|
+
updateNodeChange({
|
|
228
|
+
editor: editor,
|
|
229
|
+
node: node,
|
|
230
|
+
pos: pos
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
editor.on('update', handleUpdate);
|
|
235
|
+
return function () {
|
|
236
|
+
editor.off('update', handleUpdate);
|
|
237
|
+
};
|
|
238
|
+
}, [editor, updateNodeChange]);
|
|
199
239
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
200
240
|
editor: editor,
|
|
201
241
|
onNodeChange: updateNodeChange
|
|
@@ -360,13 +400,14 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
360
400
|
while (1) switch (_context.prev = _context.next) {
|
|
361
401
|
case 0:
|
|
362
402
|
if (!(current.node && current.pos !== undefined)) {
|
|
363
|
-
_context.next =
|
|
403
|
+
_context.next = 22;
|
|
364
404
|
break;
|
|
365
405
|
}
|
|
366
406
|
content = new Slice(Fragment.from(current.node), 0, 0);
|
|
367
407
|
textContent = current.node.textContent;
|
|
368
408
|
htmlContent = editor.view.serializeForClipboard(content).dom.innerHTML;
|
|
369
409
|
_context.prev = 4;
|
|
410
|
+
_context.prev = 5;
|
|
370
411
|
if (!(htmlContent && navigator.clipboard && "write" in navigator.clipboard)) {
|
|
371
412
|
_context.next = 11;
|
|
372
413
|
break;
|
|
@@ -377,23 +418,28 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
377
418
|
clipboardItem = new ClipboardItem({
|
|
378
419
|
"text/html": blob
|
|
379
420
|
});
|
|
380
|
-
_context.next =
|
|
421
|
+
_context.next = 11;
|
|
381
422
|
return navigator.clipboard.write([clipboardItem]);
|
|
382
|
-
case 10:
|
|
383
|
-
onTip === null || onTip === void 0 || onTip('success', '复制成功');
|
|
384
423
|
case 11:
|
|
385
424
|
_context.next = 17;
|
|
386
425
|
break;
|
|
387
426
|
case 13:
|
|
388
427
|
_context.prev = 13;
|
|
389
|
-
_context.t0 = _context["catch"](
|
|
428
|
+
_context.t0 = _context["catch"](5);
|
|
390
429
|
_context.next = 17;
|
|
391
430
|
return navigator.clipboard.writeText(textContent);
|
|
392
431
|
case 17:
|
|
432
|
+
_context.next = 22;
|
|
433
|
+
break;
|
|
434
|
+
case 19:
|
|
435
|
+
_context.prev = 19;
|
|
436
|
+
_context.t1 = _context["catch"](4);
|
|
437
|
+
onTip === null || onTip === void 0 || onTip('error', '复制失败');
|
|
438
|
+
case 22:
|
|
393
439
|
case "end":
|
|
394
440
|
return _context.stop();
|
|
395
441
|
}
|
|
396
|
-
}, _callee, null, [[4, 13]]);
|
|
442
|
+
}, _callee, null, [[4, 19], [5, 13]]);
|
|
397
443
|
})),
|
|
398
444
|
icon: /*#__PURE__*/React.createElement(FileCopyLineIcon, {
|
|
399
445
|
sx: {
|
|
@@ -1038,7 +1084,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1038
1084
|
}
|
|
1039
1085
|
}
|
|
1040
1086
|
}]
|
|
1041
|
-
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src || (_current$node17 = current.node) !== null && _current$node17 !== void 0 && _current$node17.attrs.
|
|
1087
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src || (_current$node17 = current.node) !== null && _current$node17 !== void 0 && _current$node17.attrs.url) ? [{
|
|
1042
1088
|
label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1043
1089
|
key: 'download',
|
|
1044
1090
|
icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
|
|
@@ -1048,35 +1094,36 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1048
1094
|
}),
|
|
1049
1095
|
onClick: function () {
|
|
1050
1096
|
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1051
|
-
var _current$node18, node, nodeFile, nodeBlob, nodeUrl, nodeName, a;
|
|
1097
|
+
var _current$node18, node, srcUrl, nodeFile, nodeBlob, nodeUrl, nodeName, a;
|
|
1052
1098
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1053
1099
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1054
1100
|
case 0:
|
|
1055
1101
|
if (!(current.node && current.pos !== undefined)) {
|
|
1056
|
-
_context3.next =
|
|
1102
|
+
_context3.next = 17;
|
|
1057
1103
|
break;
|
|
1058
1104
|
}
|
|
1059
1105
|
if (![NodeTypeEnum.Video, NodeTypeEnum.Audio, NodeTypeEnum.BlockAttachment].includes((_current$node18 = current.node) === null || _current$node18 === void 0 ? void 0 : _current$node18.type.name)) {
|
|
1060
|
-
_context3.next =
|
|
1106
|
+
_context3.next = 17;
|
|
1061
1107
|
break;
|
|
1062
1108
|
}
|
|
1063
1109
|
node = current.node;
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1110
|
+
srcUrl = node.attrs.src || node.attrs.url;
|
|
1111
|
+
_context3.next = 6;
|
|
1112
|
+
return fetch(srcUrl);
|
|
1113
|
+
case 6:
|
|
1067
1114
|
nodeFile = _context3.sent;
|
|
1068
|
-
_context3.next =
|
|
1115
|
+
_context3.next = 9;
|
|
1069
1116
|
return nodeFile.blob();
|
|
1070
|
-
case
|
|
1117
|
+
case 9:
|
|
1071
1118
|
nodeBlob = _context3.sent;
|
|
1072
1119
|
nodeUrl = URL.createObjectURL(nodeBlob);
|
|
1073
|
-
nodeName = node.attrs.title || "".concat(node.type.name, ".").concat(
|
|
1120
|
+
nodeName = node.attrs.title || "".concat(node.type.name, ".").concat(srcUrl.split('.').pop());
|
|
1074
1121
|
a = document.createElement('a');
|
|
1075
1122
|
a.href = nodeUrl;
|
|
1076
1123
|
a.download = nodeName;
|
|
1077
1124
|
a.click();
|
|
1078
1125
|
URL.revokeObjectURL(nodeUrl);
|
|
1079
|
-
case
|
|
1126
|
+
case 17:
|
|
1080
1127
|
case "end":
|
|
1081
1128
|
return _context3.stop();
|
|
1082
1129
|
}
|
|
@@ -137,6 +137,7 @@ export { TableViewIcon } from './table-view-icon';
|
|
|
137
137
|
export { TextIcon } from './text-icon';
|
|
138
138
|
export { TextWrapIcon } from './text-wrap-icon';
|
|
139
139
|
export { TitleIcon } from './title-icon';
|
|
140
|
+
export { TooltipLineIcon } from './tooltip-line-icon';
|
|
140
141
|
export { UnderlineIcon } from './underline-icon';
|
|
141
142
|
export { UploadCloud2LineIcon } from './upload-cloud-2-line-icon';
|
|
142
143
|
export { UploadIcon } from './upload-icon';
|
|
@@ -140,6 +140,7 @@ export { TableViewIcon } from "./table-view-icon";
|
|
|
140
140
|
export { TextIcon } from "./text-icon";
|
|
141
141
|
export { TextWrapIcon } from "./text-wrap-icon";
|
|
142
142
|
export { TitleIcon } from "./title-icon";
|
|
143
|
+
export { TooltipLineIcon } from "./tooltip-line-icon";
|
|
143
144
|
export { UnderlineIcon } from "./underline-icon";
|
|
144
145
|
export { UploadCloud2LineIcon } from "./upload-cloud-2-line-icon";
|
|
145
146
|
export { UploadIcon } from "./upload-icon";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var TooltipLineIcon = function TooltipLineIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M14.45 19L12 22.5L9.55 19H3C2.73478 19 2.48043 18.8946 2.29289 18.7071C2.10536 18.5196 2 18.2652 2 18V4C2 3.73478 2.10536 3.48043 2.29289 3.29289C2.48043 3.10536 2.73478 3 3 3H21C21.2652 3 21.5196 3.10536 21.7071 3.29289C21.8946 3.48043 22 3.73478 22 4V18C22 18.2652 21.8946 18.5196 21.7071 18.7071C21.5196 18.8946 21.2652 19 21 19H14.45ZM13.409 17H20V5H4V17H10.591L12 19.012L13.409 17Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
TooltipLineIcon.displayName = 'icon-tooltip-line';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["className"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
3
8
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
5
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -12,7 +17,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
18
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
import { ArrowDownSLineIcon, FileCopyLineIcon } from "../../../component/Icons";
|
|
20
|
+
import { ArrowDownSLineIcon, CheckboxCircleLineIcon, FileCopyLineIcon } from "../../../component/Icons";
|
|
16
21
|
import { languages } from "../../../contants/highlight";
|
|
17
22
|
import { Box, Divider, ListSubheader, MenuItem, Select, Stack, TextField } from '@mui/material';
|
|
18
23
|
import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';
|
|
@@ -144,7 +149,8 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
144
149
|
right: 0,
|
|
145
150
|
height: '1.25rem',
|
|
146
151
|
lineHeight: '1.25rem',
|
|
147
|
-
|
|
152
|
+
pl: 2.5,
|
|
153
|
+
pr: 1,
|
|
148
154
|
py: 2,
|
|
149
155
|
zIndex: 1,
|
|
150
156
|
color: 'text.tertiary',
|
|
@@ -330,15 +336,22 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
330
336
|
bgcolor: 'inherit',
|
|
331
337
|
color: 'inherit'
|
|
332
338
|
}
|
|
333
|
-
}, /*#__PURE__*/React.createElement(
|
|
339
|
+
}, copyText === '复制成功' ? /*#__PURE__*/React.createElement(CheckboxCircleLineIcon, {
|
|
340
|
+
sx: {
|
|
341
|
+
fontSize: '0.75rem',
|
|
342
|
+
color: 'success.main'
|
|
343
|
+
}
|
|
344
|
+
}) : /*#__PURE__*/React.createElement(FileCopyLineIcon, {
|
|
334
345
|
sx: {
|
|
335
346
|
fontSize: '0.75rem',
|
|
336
347
|
color: 'inherit'
|
|
337
348
|
}
|
|
338
349
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
339
|
-
sx: {
|
|
350
|
+
sx: _objectSpread({
|
|
340
351
|
lineHeight: 1
|
|
341
|
-
}
|
|
352
|
+
}, copyText === '复制成功' ? {
|
|
353
|
+
color: 'success.main'
|
|
354
|
+
} : {})
|
|
342
355
|
}, copyText)))), /*#__PURE__*/React.createElement(Box, {
|
|
343
356
|
component: 'pre',
|
|
344
357
|
sx: {
|
|
@@ -95,30 +95,37 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
95
95
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
96
96
|
isCropping = _useState6[0],
|
|
97
97
|
setIsCropping = _useState6[1];
|
|
98
|
-
var _useState7 = useState(attrs.src),
|
|
98
|
+
var _useState7 = useState(attrs.src || ''),
|
|
99
99
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
100
100
|
editSrc = _useState8[0],
|
|
101
101
|
setEditSrc = _useState8[1];
|
|
102
|
-
var _useState9 = useState(
|
|
102
|
+
var _useState9 = useState(attrs.title || ''),
|
|
103
103
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
editTitle = _useState10[0],
|
|
105
|
+
setEditTitle = _useState10[1];
|
|
106
|
+
var _useState11 = useState(null),
|
|
107
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
108
|
+
dragCorner = _useState12[0],
|
|
109
|
+
setDragCorner = _useState12[1];
|
|
106
110
|
var dragStartXRef = useRef(0);
|
|
107
111
|
var dragStartWidthRef = useRef(0);
|
|
108
|
-
var _useState11 = useState(attrs.title || ''),
|
|
109
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
110
|
-
editTitle = _useState12[0],
|
|
111
|
-
setEditTitle = _useState12[1];
|
|
112
112
|
var _useState13 = useState(null),
|
|
113
113
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
114
114
|
anchorEl = _useState14[0],
|
|
115
115
|
setAnchorEl = _useState14[1];
|
|
116
116
|
var imageContentRef = useRef(null);
|
|
117
|
+
var editButtonRef = useRef(null);
|
|
118
|
+
var _useState15 = useState(false),
|
|
119
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
120
|
+
keepHoverPopoverOpen = _useState16[0],
|
|
121
|
+
setKeepHoverPopoverOpen = _useState16[1];
|
|
117
122
|
var handleShowPopover = function handleShowPopover() {
|
|
118
|
-
|
|
123
|
+
setKeepHoverPopoverOpen(true);
|
|
124
|
+
setAnchorEl(editButtonRef.current);
|
|
119
125
|
};
|
|
120
126
|
var handleClosePopover = function handleClosePopover() {
|
|
121
|
-
|
|
127
|
+
setAnchorEl(null);
|
|
128
|
+
setKeepHoverPopoverOpen(false);
|
|
122
129
|
};
|
|
123
130
|
|
|
124
131
|
// 获取当前实际显示的图片宽度
|
|
@@ -135,37 +142,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
135
142
|
}
|
|
136
143
|
return attrs.width;
|
|
137
144
|
};
|
|
138
|
-
useEffect(function () {
|
|
139
|
-
if (attrs.src && (!attrs.width || attrs.width <= 0)) {
|
|
140
|
-
getImageDimensions(attrs.src).then(function (dimensions) {
|
|
141
|
-
try {
|
|
142
|
-
var pos = typeof getPos === 'function' ? getPos() : null;
|
|
143
|
-
if (pos === null || pos === undefined) return;
|
|
144
|
-
var currentNode = editor.state.doc.nodeAt(pos);
|
|
145
|
-
if (!currentNode || currentNode.type.name !== 'image') return;
|
|
146
|
-
updateAttributes({
|
|
147
|
-
src: attrs.src,
|
|
148
|
-
width: dimensions.width
|
|
149
|
-
});
|
|
150
|
-
} catch (error) {
|
|
151
|
-
// console.warn('Failed to update image dimensions:', error)
|
|
152
|
-
}
|
|
153
|
-
}).catch(function (error) {
|
|
154
|
-
try {
|
|
155
|
-
var pos = typeof getPos === 'function' ? getPos() : null;
|
|
156
|
-
if (pos === null || pos === undefined) return;
|
|
157
|
-
var currentNode = editor.state.doc.nodeAt(pos);
|
|
158
|
-
if (!currentNode || currentNode.type.name !== 'image') return;
|
|
159
|
-
updateAttributes({
|
|
160
|
-
src: attrs.src,
|
|
161
|
-
width: 400
|
|
162
|
-
});
|
|
163
|
-
} catch (updateError) {
|
|
164
|
-
// console.warn('Failed to update image attributes with fallback width:', updateError)
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}, [attrs.src, attrs.width, updateAttributes, getPos, editor]);
|
|
169
145
|
var handleMouseDown = function handleMouseDown(e, corner) {
|
|
170
146
|
e.preventDefault();
|
|
171
147
|
e.stopPropagation();
|
|
@@ -272,6 +248,39 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
272
248
|
}
|
|
273
249
|
chain.toggleTextAlign(align).run();
|
|
274
250
|
};
|
|
251
|
+
useEffect(function () {
|
|
252
|
+
if (attrs.src && (!attrs.width || attrs.width <= 0)) {
|
|
253
|
+
getImageDimensions(attrs.src).then(function (dimensions) {
|
|
254
|
+
try {
|
|
255
|
+
var pos = typeof getPos === 'function' ? getPos() : null;
|
|
256
|
+
if (pos === null || pos === undefined) return;
|
|
257
|
+
var currentNode = editor.state.doc.nodeAt(pos);
|
|
258
|
+
if (!currentNode || currentNode.type.name !== 'image') return;
|
|
259
|
+
updateAttributes({
|
|
260
|
+
src: attrs.src,
|
|
261
|
+
title: attrs.title || '',
|
|
262
|
+
width: dimensions.width
|
|
263
|
+
});
|
|
264
|
+
} catch (error) {}
|
|
265
|
+
}).catch(function () {
|
|
266
|
+
try {
|
|
267
|
+
var pos = typeof getPos === 'function' ? getPos() : null;
|
|
268
|
+
if (pos === null || pos === undefined) return;
|
|
269
|
+
var currentNode = editor.state.doc.nodeAt(pos);
|
|
270
|
+
if (!currentNode || currentNode.type.name !== 'image') return;
|
|
271
|
+
updateAttributes({
|
|
272
|
+
src: attrs.src,
|
|
273
|
+
title: attrs.title || '',
|
|
274
|
+
width: 400
|
|
275
|
+
});
|
|
276
|
+
} catch (updateError) {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}, [attrs, updateAttributes, getPos, editor]);
|
|
280
|
+
useEffect(function () {
|
|
281
|
+
setEditSrc(attrs.src || '');
|
|
282
|
+
setEditTitle(attrs.title || '');
|
|
283
|
+
}, [attrs.src, attrs.title]);
|
|
275
284
|
useEffect(function () {
|
|
276
285
|
if (isDragging) {
|
|
277
286
|
document.addEventListener('mousemove', handleMouseMove);
|
|
@@ -315,6 +324,9 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
315
324
|
as: 'span',
|
|
316
325
|
'data-drag-handle': false
|
|
317
326
|
}, /*#__PURE__*/React.createElement(HoverPopover, {
|
|
327
|
+
keepOpen: keepHoverPopoverOpen,
|
|
328
|
+
placement: "top",
|
|
329
|
+
offset: 4,
|
|
318
330
|
actions: /*#__PURE__*/React.createElement(Stack, {
|
|
319
331
|
direction: 'row',
|
|
320
332
|
alignItems: 'center',
|
|
@@ -322,6 +334,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
322
334
|
p: 0.5
|
|
323
335
|
}
|
|
324
336
|
}, /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
337
|
+
ref: editButtonRef,
|
|
325
338
|
icon: /*#__PURE__*/React.createElement(EditLineIcon, {
|
|
326
339
|
sx: {
|
|
327
340
|
fontSize: '1rem'
|
|
@@ -393,9 +406,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
393
406
|
}),
|
|
394
407
|
tip: "\u5220\u9664\u56FE\u7247",
|
|
395
408
|
onClick: deleteNode
|
|
396
|
-
}))
|
|
397
|
-
placement: "top",
|
|
398
|
-
offset: 4
|
|
409
|
+
}))
|
|
399
410
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
400
411
|
component: 'span',
|
|
401
412
|
ref: imageContentRef,
|
|
@@ -518,7 +529,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
518
529
|
open: Boolean(anchorEl),
|
|
519
530
|
anchorEl: anchorEl,
|
|
520
531
|
onClose: handleClosePopover,
|
|
521
|
-
placement: "
|
|
532
|
+
placement: "bottom"
|
|
522
533
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
523
534
|
sx: {
|
|
524
535
|
p: 2,
|
|
@@ -544,7 +555,7 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
544
555
|
fontSize: '0.75rem',
|
|
545
556
|
color: 'text.secondary',
|
|
546
557
|
lineHeight: '1.5',
|
|
547
|
-
|
|
558
|
+
my: 1
|
|
548
559
|
}
|
|
549
560
|
}, "\u56FE\u7247\u63CF\u8FF0"), /*#__PURE__*/React.createElement(TextField, {
|
|
550
561
|
fullWidth: true,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Box, Tooltip } from "@mui/material";
|
|
2
|
+
import { MarkViewContent } from "@tiptap/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
var TooltipView = function TooltipView(_ref) {
|
|
5
|
+
var mark = _ref.mark;
|
|
6
|
+
var tooltip = mark.attrs.tooltip;
|
|
7
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
8
|
+
arrow: true,
|
|
9
|
+
placement: "top",
|
|
10
|
+
title: /*#__PURE__*/React.createElement(Box, null, tooltip)
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
12
|
+
component: "span",
|
|
13
|
+
sx: {
|
|
14
|
+
borderBottom: '1px dotted',
|
|
15
|
+
borderColor: 'text.secondary'
|
|
16
|
+
}
|
|
17
|
+
}, /*#__PURE__*/React.createElement(MarkViewContent, null)));
|
|
18
|
+
};
|
|
19
|
+
export default TooltipView;
|
|
@@ -7,6 +7,6 @@ export interface UploadProgressAttributes {
|
|
|
7
7
|
tempId: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const getFileIcon: (fileType: string) => React.JSX.Element;
|
|
10
|
-
export declare const getFileTypeText: (fileType: string) => "
|
|
10
|
+
export declare const getFileTypeText: (fileType: string) => "图片" | "视频" | "音频" | "文件";
|
|
11
11
|
declare const UploadProgressView: React.FC<NodeViewProps>;
|
|
12
12
|
export default UploadProgressView;
|
package/dist/extension/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import StarterKit from '@tiptap/starter-kit';
|
|
|
14
14
|
import { PLACEHOLDER } from "../contants/placeholder";
|
|
15
15
|
import { AiWritingExtension, ImeComposition, SlashCommands, StructuredDiffExtension } from "./extension";
|
|
16
16
|
import { CodeExtension } from "./mark/Code";
|
|
17
|
+
import Tooltip from "./mark/Tooltip";
|
|
17
18
|
import { AlertExtension, AudioExtension, BlockAttachmentExtension, BlockLinkExtension, CodeBlockLowlightExtension, CustomBlockMathExtension, CustomHorizontalRule, CustomInlineMathExtension, CustomSubscript, CustomSuperscript, DetailsContentExtension, DetailsExtension, DetailsSummaryExtension, EmojiExtension, FileHandlerExtension, FlipGridColumnExtension, FlipGridExtension, FlowExtension, IframeExtension, ImageExtension, Indent, InlineAttachmentExtension, InlineLinkExtension, InlineUploadProgressExtension, ListExtension, MentionExtension, TableExtension, TableOfContents, UploadProgressExtension, VerticalAlign, VideoExtension, YamlFormat, YoutubeExtension } from "./node";
|
|
18
19
|
export var getExtensions = function getExtensions(_ref) {
|
|
19
20
|
var limit = _ref.limit,
|
|
@@ -47,11 +48,11 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
47
48
|
color: 'var(--mui-palette-primary-main)',
|
|
48
49
|
width: 2
|
|
49
50
|
}
|
|
50
|
-
}), YamlFormat, TextStyleKit, CodeExtension,
|
|
51
|
-
mermaidOptions: mermaidOptions
|
|
52
|
-
}), ListExtension, EmojiExtension, AlertExtension, CustomSubscript, DetailsExtension, CustomSuperscript, DetailsContentExtension, DetailsSummaryExtension, CodeBlockLowlightExtension, InlineUploadProgressExtension, CustomHorizontalRule].concat(_toConsumableArray(TableExtension({
|
|
51
|
+
}), YamlFormat, TextStyleKit, CodeExtension, Tooltip, ListExtension, EmojiExtension, AlertExtension, CustomSubscript, DetailsExtension, CustomSuperscript, FlipGridExtension, DetailsContentExtension, DetailsSummaryExtension, CodeBlockLowlightExtension, InlineUploadProgressExtension, CustomHorizontalRule, FlipGridColumnExtension].concat(_toConsumableArray(TableExtension({
|
|
53
52
|
editable: editable
|
|
54
|
-
})), [
|
|
53
|
+
})), [FlowExtension({
|
|
54
|
+
mermaidOptions: mermaidOptions
|
|
55
|
+
}), CustomBlockMathExtension({
|
|
55
56
|
onError: onError
|
|
56
57
|
}), CustomInlineMathExtension({
|
|
57
58
|
onError: onError
|
|
@@ -175,11 +176,6 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
175
176
|
var Youtube = YoutubeExtension(youtubeOptions);
|
|
176
177
|
defaultExtensions.push(Youtube);
|
|
177
178
|
}
|
|
178
|
-
if (!(exclude !== null && exclude !== void 0 && exclude.includes('flow'))) {
|
|
179
|
-
defaultExtensions.push(FlowExtension({
|
|
180
|
-
onError: onError
|
|
181
|
-
}));
|
|
182
|
-
}
|
|
183
179
|
if (extensionsProps && extensionsProps.length > 0) {
|
|
184
180
|
defaultExtensions.push.apply(defaultExtensions, _toConsumableArray(extensionsProps));
|
|
185
181
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Mark } from '@tiptap/core';
|
|
2
|
+
export interface TooltipOptions {
|
|
3
|
+
HTMLAttributes: Record<string, any>;
|
|
4
|
+
}
|
|
5
|
+
declare module '@tiptap/core' {
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
|
+
tooltip: {
|
|
8
|
+
/**
|
|
9
|
+
* Set a tooltip mark
|
|
10
|
+
*/
|
|
11
|
+
setTooltip: (tooltip: string) => ReturnType;
|
|
12
|
+
/**
|
|
13
|
+
* Toggle a tooltip mark
|
|
14
|
+
*/
|
|
15
|
+
toggleTooltip: (tooltip?: string) => ReturnType;
|
|
16
|
+
/**
|
|
17
|
+
* Unset a tooltip mark
|
|
18
|
+
*/
|
|
19
|
+
unsetTooltip: () => ReturnType;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare const Tooltip: Mark<TooltipOptions, any>;
|
|
24
|
+
export default Tooltip;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Mark, mergeAttributes } from '@tiptap/core';
|
|
2
|
+
import { Plugin } from '@tiptap/pm/state';
|
|
3
|
+
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
+
import { ReactMarkViewRenderer } from '@tiptap/react';
|
|
5
|
+
import TooltipView from "../component/Tooltip";
|
|
6
|
+
export var Tooltip = Mark.create({
|
|
7
|
+
name: 'tooltip',
|
|
8
|
+
addOptions: function addOptions() {
|
|
9
|
+
return {
|
|
10
|
+
HTMLAttributes: {}
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
addAttributes: function addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
tooltip: {
|
|
16
|
+
default: null,
|
|
17
|
+
parseHTML: function parseHTML(element) {
|
|
18
|
+
return element.getAttribute('data-tooltip');
|
|
19
|
+
},
|
|
20
|
+
renderHTML: function renderHTML(attributes) {
|
|
21
|
+
if (!attributes.tooltip) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
'data-tooltip': attributes.tooltip,
|
|
26
|
+
'class': 'tooltip-mark'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
parseHTML: function parseHTML() {
|
|
33
|
+
return [{
|
|
34
|
+
tag: 'span[data-tooltip]'
|
|
35
|
+
}];
|
|
36
|
+
},
|
|
37
|
+
renderHTML: function renderHTML(_ref) {
|
|
38
|
+
var HTMLAttributes = _ref.HTMLAttributes;
|
|
39
|
+
return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
40
|
+
},
|
|
41
|
+
addCommands: function addCommands() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
return {
|
|
44
|
+
setTooltip: function setTooltip(tooltip) {
|
|
45
|
+
return function (_ref2) {
|
|
46
|
+
var commands = _ref2.commands;
|
|
47
|
+
return commands.setMark(_this.name, {
|
|
48
|
+
tooltip: tooltip
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
toggleTooltip: function toggleTooltip(tooltip) {
|
|
53
|
+
return function (_ref3) {
|
|
54
|
+
var commands = _ref3.commands;
|
|
55
|
+
return commands.toggleMark(_this.name, {
|
|
56
|
+
tooltip: tooltip
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
unsetTooltip: function unsetTooltip() {
|
|
61
|
+
return function (_ref4) {
|
|
62
|
+
var commands = _ref4.commands;
|
|
63
|
+
return commands.unsetMark(_this.name);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
addMarkView: function addMarkView() {
|
|
69
|
+
return ReactMarkViewRenderer(TooltipView);
|
|
70
|
+
},
|
|
71
|
+
addProseMirrorPlugins: function addProseMirrorPlugins() {
|
|
72
|
+
var _this2 = this;
|
|
73
|
+
return [new Plugin({
|
|
74
|
+
props: {
|
|
75
|
+
decorations: function decorations(state) {
|
|
76
|
+
var decorations = [];
|
|
77
|
+
state.doc.descendants(function (node, pos) {
|
|
78
|
+
var mark = node.marks.find(function (mark) {
|
|
79
|
+
return mark.type.name === _this2.name;
|
|
80
|
+
});
|
|
81
|
+
if (mark) {
|
|
82
|
+
var _tooltip = mark.attrs.tooltip;
|
|
83
|
+
if (_tooltip) {
|
|
84
|
+
decorations.push(Decoration.inline(pos, pos + node.nodeSize, {
|
|
85
|
+
class: 'tooltip-mark',
|
|
86
|
+
'data-tooltip': _tooltip
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return DecorationSet.create(state.doc, decorations);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})];
|
|
95
|
+
},
|
|
96
|
+
markdownTokenName: 'tooltip',
|
|
97
|
+
markdownTokenizer: {
|
|
98
|
+
name: 'tooltip',
|
|
99
|
+
level: 'inline',
|
|
100
|
+
start: function start(src) {
|
|
101
|
+
return src.indexOf('{');
|
|
102
|
+
},
|
|
103
|
+
tokenize: function tokenize(src, _tokens, helpers) {
|
|
104
|
+
var match = /^\{([^}]+)\}\(([^)]+)\)/.exec(src);
|
|
105
|
+
if (!match) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
var text = match[1];
|
|
109
|
+
var tooltip = match[2];
|
|
110
|
+
return {
|
|
111
|
+
type: 'tooltip',
|
|
112
|
+
raw: match[0],
|
|
113
|
+
text: text,
|
|
114
|
+
tooltip: tooltip,
|
|
115
|
+
tokens: helpers.inlineTokens(text)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
parseMarkdown: function parseMarkdown(token, helpers) {
|
|
120
|
+
var content = helpers.parseInline(token.tokens || []);
|
|
121
|
+
if (!Array.isArray(content)) {
|
|
122
|
+
content = content ? [content] : [];
|
|
123
|
+
}
|
|
124
|
+
if (content.length === 0 && token.text) {
|
|
125
|
+
content = [helpers.createTextNode(token.text)];
|
|
126
|
+
}
|
|
127
|
+
return helpers.applyMark('tooltip', content, {
|
|
128
|
+
tooltip: token.tooltip
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
renderMarkdown: function renderMarkdown(node, helpers) {
|
|
132
|
+
var _node$attrs;
|
|
133
|
+
var content = helpers.renderChildren(node);
|
|
134
|
+
var tooltip = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.tooltip) || '';
|
|
135
|
+
if (!tooltip) {
|
|
136
|
+
return content;
|
|
137
|
+
}
|
|
138
|
+
return "{".concat(content, "}(").concat(tooltip, ")");
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
export default Tooltip;
|
package/dist/index.css
CHANGED