@ctzhian/tiptap 2.1.7 → 2.1.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.
- package/dist/Editor/demo.js +1 -1
- package/dist/EditorMarkdown/demo.js +1 -1
- package/dist/asset/css/index.css +13 -1
- package/dist/extension/component/CodeBlock/Readonly.js +45 -25
- package/dist/extension/component/CodeBlock/index.js +52 -31
- package/dist/extension/node/CodeBlockLowlight.js +1 -0
- package/dist/index.css +0 -47
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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<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\" colwidth=\"361\" 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\" colwidth=\"361\" 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\" colwidth=\"361\" 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<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\" colwidth=\"361\" 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\" colwidth=\"361\" 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\" colwidth=\"361\" 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";
|
|
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
|
|
@@ -13,7 +13,7 @@ import { Box } from '@mui/material';
|
|
|
13
13
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
14
14
|
import "../index.css";
|
|
15
15
|
var Reader = function Reader() {
|
|
16
|
-
var _useState = useState(
|
|
16
|
+
var _useState = useState("本文用以记录 Gitlab 相关问题及解答\n\n## 我在使用 `git@git.in.chaitin.net:ns/repo` 时可以访问仓库,但是 `https://git.in.chaitin.net/ns/repo` 无法访问\n\n问题通常出现 git clone 与其他依赖 git 进行的操作,如 `go get` 等,具体报错可能为 `Permission Denied`.\n\n在使用 curl 借助 `CI_JOB_TOKEN` 获取其他仓库 cicd job 产物或者 generic package 时,其具体报错为 `404 Not Found` 的问题.\n\n原因是在使用 `git@git.in.chaitin.net` 时,使用的是 ssh 协议,此时默认使用的是 `~/.ssh` 下的私钥进行认证你在 gitlab 中添加的 `SSH Keys`。而使用 `https://git.in.chaitin.net/ns/repo` 时,使用的是 http 协议,此时默认使用的是 `~/.netrc` 认证你在 gitlab 中申请的 `Access tokens`。部分软件如 `go get` 默认使用的便是 http 来拉取代码,因此需要额外配置。\n\n这里推荐两种解决方案:\n\n1. 配置 `~/.netrc` 文件(推荐)\n\n 在 ~/.netrc 文件中添加以下配置:\n\n ```text\n machine git.in.chaitin.net login git password <your access token>\n ```\n\n 在 gitlab cicd job 中遇到拉取其他仓库时遇到权限问题可以使用本配置,比如可以在 job 的 `before_script` 阶段添加以下命令:\n\n ```shell\n echo \"machine git.in.chaitin.net login git password $CI_JOB_TOKEN\" >> ~/.netrc\n ```\n\n 注意: 其中 `$CI_JOB_TOKEN` 是 job 运行期间生成的 token,其权限与 trigger 用户相同,详见 [CI Job Token](https://docs.gitlab.com/ci/jobs/ci_job_token/)。其 Token 权限由 `pipeline 触发者`权限以及`目标仓库权限`共同决定。因此被拉取的目标仓库也需要保证其 `Setting -> CI/CD -> Job token permissions` 配置正确,允许源仓库的 CI/CD 能够访问到该仓库,否则依然会出现如 `404 Not Found`, `403 Forbidden` 的权限问题。(如果你是 pipeline 触发者,可以手动在浏览器通过 gitlab api 访问目标仓库的 generic package 或者 job artifact 如果可以正常下载,说明是 `Job token permissions` 问题)\n\n2. 配置 `git url replace`\n\n 在 ~/.gitconfig 文件中添加以下配置:\n\n ```ini\n [url \"git@git.in.chaitin.net:\"]\n insteadOf = https://git.in.chaitin.net/\n ```\n\n 这个配置可以将所有 `https://git.in.chaitin.net/` 请求替换为 `git@git.in.chaitin.net:` 使用 ssh 来拉取代码仓库\n\n## 我在 clone gitlab 仓库时没问题,但是 lfs 遇到了 EOF 问题\n\nEOF 在大多数情况下由代理导致,如果代理不允许客户端访问某个网站,行为可能是提早结束连接,导致 `EOF` 错误。如\n\n> 在 ubunu 虚拟机里无法拉取 safeline-aliyun 项目里的 lfs 文件怎么处理?\n\n```bash\nroot@OPS-5108:~/proj/safeline-aliyun# git lfs fetch --all\nfetch: 34 object(s) found, done.\nfetch: Fetching all references...\nbatch response: Post https://git.in.chaitin.net/patronus/safeline-aliyun.git/info/lfs/objects/batch: EOF\nerror: failed to fetch some objects from 'https://git.in.chaitin.net/patronus/safeline-aliyun.git/info/lfs'\n```\n\n可以看到返回了 EOF 问题,经查代理未配置在 git config 中。从 `env` 中可以看到用户配置了 *_proxy 但其中发现 `no_proxy` 配置不正确:\n\n```shell\nroot@OPS-5108:~/proj/safeline-aliyun# env | grep pro\nno_proxy=localhost, 127.0.0.1, ::1\nPWD=/root/proj/safeline-aliyun\nftp_proxy=http://proxy.in.chaitin.net:8123\nhttps_proxy=http://proxy.in.chaitin.net:8123\nproxy=http://proxy.in.chaitin.net:8123\nhttp_proxy=http://proxy.in.chaitin.net:8123\nOLDPWD=/root/proj\n```\n\n需要按照 [代理配置](https://info.chaitin.net/colab-editor/page/%E7%A0%94%E5%8F%91%E4%BD%93%E7%B3%BB%2F%E7%A0%94%E5%8F%91%E6%94%AF%E6%8C%81%2F%E4%BB%A3%E7%90%86%E6%89%AB%E7%9B%B2) 进行正确配置后,重新执行操作,发现 EOF 问题被解决。\n\n## 我在访问公司内部服务时报错 `x509: certificate signed by unknown authority`\n\n公司部分内部服务采用自签名证书,导致客户端在访问这些服务时会遇到 `x509: certificate signed by unknown authority` 错误。为了确保客户端能够信任这些自签名证书,你需要配置信任自签名证书即 CA。\n\n以 debian 系系统举例:\n\n```shell\ncurl -o /usr/local/share/ca-certificates/chaitin_ca.crt -L https://chaitin-ops-public.cn-beijing.oss.aliyuncs.com/Chaitin_Ltd_Root_CA.pem\nupdate-ca-certificates\n```\n\n如果无法访问外网,可以尝试 `http://s3-ephemeral.in.chaitin.net/dev/Chaitin_Ltd_Root_CA.pem`\n\n其他系统 CA 证书安装请参考 [安装CA证书](https://info.chaitin.net/colab-editor/page/IT%E5%8A%9E%E5%85%AC/%E5%8A%9E%E5%85%AC%E7%BD%91%E7%BB%9C/windows%E7%94%A8%E6%88%B7/%E5%A4%87%E9%80%89%E6%96%B9%E6%A1%88%EF%BC%88Windows%EF%BC%89/%E8%AF%81%E4%B9%A6%E5%AE%89%E8%A3%85%28windows%29/%E9%95%BF%E4%BA%AD%E6%A0%B9%E8%AF%81%E4%B9%A6%E5%AE%89%E8%A3%85%28windows%29)\n"),
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
mdContent = _useState2[0],
|
|
19
19
|
setMdContent = _useState2[1];
|
package/dist/asset/css/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import 'highlight.js/styles/atom-one-
|
|
1
|
+
@import 'highlight.js/styles/atom-one-light.css';
|
|
2
2
|
@import 'katex/dist/katex.min.css';
|
|
3
3
|
|
|
4
4
|
:root {
|
|
@@ -29,6 +29,17 @@
|
|
|
29
29
|
text-decoration: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.tiptap.ProseMirror *:not(pre)>code {
|
|
33
|
+
background-color: var(--mui-palette-background-paper3);
|
|
34
|
+
border: 1px solid var(--mui-palette-divider);
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
font-size: 90%;
|
|
37
|
+
white-space: break-spaces;
|
|
38
|
+
word-break: break-word;
|
|
39
|
+
overflow-wrap: break-word;
|
|
40
|
+
padding: 0.125rem 0.25rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
.tiptap.ProseMirror label:has(input[type="checkbox"]) {
|
|
33
44
|
line-height: 1;
|
|
34
45
|
padding-top: 0.5rem;
|
|
@@ -93,6 +104,7 @@
|
|
|
93
104
|
user-select: none;
|
|
94
105
|
}
|
|
95
106
|
|
|
107
|
+
.tiptap.ProseMirror .react-renderer.node-codeBlock,
|
|
96
108
|
.tiptap.ProseMirror .react-renderer.node-blockLink,
|
|
97
109
|
.tiptap.ProseMirror .react-renderer.node-blockAttachment {
|
|
98
110
|
display: block;
|
|
@@ -11,8 +11,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { FileCopyLineIcon } from "../../../component/Icons";
|
|
12
12
|
import { Box, Divider, Stack } from '@mui/material';
|
|
13
13
|
import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';
|
|
14
|
-
import React, { useCallback, useState } from 'react';
|
|
15
|
-
var ReadonlyCodeBlock = function
|
|
14
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
15
|
+
var ReadonlyCodeBlock = /*#__PURE__*/memo(function (_ref) {
|
|
16
16
|
var node = _ref.node,
|
|
17
17
|
selected = _ref.selected;
|
|
18
18
|
var _useState = useState('复制'),
|
|
@@ -26,7 +26,7 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
26
26
|
var attrs = node.attrs;
|
|
27
27
|
var handleCopy = useCallback( /*#__PURE__*/function () {
|
|
28
28
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
29
|
-
var codeText;
|
|
29
|
+
var codeText, timer;
|
|
30
30
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
31
31
|
while (1) switch (_context.prev = _context.next) {
|
|
32
32
|
case 0:
|
|
@@ -38,20 +38,21 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
38
38
|
return navigator.clipboard.writeText(codeText);
|
|
39
39
|
case 6:
|
|
40
40
|
setCopyText('复制成功');
|
|
41
|
-
setTimeout(function () {
|
|
41
|
+
timer = setTimeout(function () {
|
|
42
42
|
setCopyText('复制');
|
|
43
43
|
}, 2000);
|
|
44
|
-
_context.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
return _context.abrupt("return", function () {
|
|
45
|
+
return clearTimeout(timer);
|
|
46
|
+
});
|
|
47
|
+
case 11:
|
|
48
|
+
_context.prev = 11;
|
|
48
49
|
_context.t0 = _context["catch"](3);
|
|
49
50
|
console.error('复制失败:', _context.t0);
|
|
50
|
-
case
|
|
51
|
+
case 14:
|
|
51
52
|
case "end":
|
|
52
53
|
return _context.stop();
|
|
53
54
|
}
|
|
54
|
-
}, _callee, null, [[3,
|
|
55
|
+
}, _callee, null, [[3, 11]]);
|
|
55
56
|
}));
|
|
56
57
|
return function (_x) {
|
|
57
58
|
return _ref2.apply(this, arguments);
|
|
@@ -67,11 +68,11 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
67
68
|
return setIsHovering(false);
|
|
68
69
|
}
|
|
69
70
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
70
|
-
component: "pre",
|
|
71
71
|
sx: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
position: 'relative',
|
|
73
|
+
border: '1px solid',
|
|
74
|
+
borderColor: 'divider',
|
|
75
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
75
76
|
overflow: 'hidden'
|
|
76
77
|
}
|
|
77
78
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -80,26 +81,37 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
80
81
|
justifyContent: "space-between",
|
|
81
82
|
className: "codeblock-toolbar",
|
|
82
83
|
sx: {
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
top: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
right: 0,
|
|
88
|
+
height: '1.25rem',
|
|
89
|
+
lineHeight: '1.25rem',
|
|
90
|
+
px: 2.5,
|
|
91
|
+
py: 2,
|
|
83
92
|
zIndex: 1,
|
|
84
|
-
|
|
93
|
+
color: 'text.tertiary',
|
|
94
|
+
borderBottom: '1px solid',
|
|
95
|
+
borderColor: 'divider'
|
|
85
96
|
}
|
|
86
97
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
87
98
|
sx: {
|
|
88
99
|
flex: 1,
|
|
89
100
|
fontSize: '0.875rem',
|
|
90
|
-
color: 'text.tertiary',
|
|
91
101
|
letterSpacing: '0.01rem'
|
|
92
102
|
}
|
|
93
103
|
}, attrs.title || '代码块'), isHovering && /*#__PURE__*/React.createElement(Stack, {
|
|
94
104
|
direction: "row",
|
|
95
105
|
alignItems: "center",
|
|
96
|
-
gap: 0.5
|
|
106
|
+
gap: 0.5,
|
|
107
|
+
sx: {
|
|
108
|
+
fontSize: '0.75rem'
|
|
109
|
+
}
|
|
97
110
|
}, /*#__PURE__*/React.createElement(Box, null, attrs.language || 'Auto'), /*#__PURE__*/React.createElement(Divider, {
|
|
98
111
|
orientation: "vertical",
|
|
99
112
|
flexItem: true,
|
|
100
113
|
sx: {
|
|
101
|
-
height: '
|
|
102
|
-
mr: 0.5,
|
|
114
|
+
height: '0.75rem',
|
|
103
115
|
ml: 1,
|
|
104
116
|
alignSelf: 'center',
|
|
105
117
|
borderColor: 'divider'
|
|
@@ -111,6 +123,7 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
111
123
|
onClick: handleCopy,
|
|
112
124
|
sx: {
|
|
113
125
|
px: 1,
|
|
126
|
+
py: 0.5,
|
|
114
127
|
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
115
128
|
cursor: 'pointer',
|
|
116
129
|
userSelect: 'none',
|
|
@@ -119,22 +132,29 @@ var ReadonlyCodeBlock = function ReadonlyCodeBlock(_ref) {
|
|
|
119
132
|
}
|
|
120
133
|
}, /*#__PURE__*/React.createElement(FileCopyLineIcon, {
|
|
121
134
|
sx: {
|
|
122
|
-
fontSize: '0.
|
|
135
|
+
fontSize: '0.75rem',
|
|
123
136
|
color: 'inherit'
|
|
124
137
|
}
|
|
125
138
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
126
139
|
sx: {
|
|
127
|
-
fontSize: '0.75rem',
|
|
128
140
|
lineHeight: 1
|
|
129
141
|
}
|
|
130
|
-
}, copyText)))), /*#__PURE__*/React.createElement(
|
|
142
|
+
}, copyText)))), /*#__PURE__*/React.createElement(Box, {
|
|
143
|
+
component: 'pre',
|
|
144
|
+
sx: {
|
|
145
|
+
m: 0
|
|
146
|
+
}
|
|
147
|
+
}, /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
148
|
+
as: "code",
|
|
149
|
+
className: "hljs",
|
|
131
150
|
style: {
|
|
132
|
-
|
|
151
|
+
padding: '3rem 1.25rem 0.75rem 1.25rem',
|
|
133
152
|
fontSize: '0.875rem',
|
|
134
153
|
lineHeight: '1.5',
|
|
135
154
|
whiteSpace: 'pre-wrap',
|
|
136
155
|
wordBreak: 'break-word'
|
|
137
156
|
}
|
|
138
|
-
})));
|
|
139
|
-
};
|
|
157
|
+
}))));
|
|
158
|
+
});
|
|
159
|
+
ReadonlyCodeBlock.displayName = 'ReadonlyCodeBlock';
|
|
140
160
|
export default ReadonlyCodeBlock;
|
|
@@ -16,7 +16,7 @@ import { ArrowDownSLineIcon, FileCopyLineIcon } from "../../../component/Icons";
|
|
|
16
16
|
import { languages } from "../../../contants/highlight";
|
|
17
17
|
import { Box, Divider, ListSubheader, MenuItem, Select, Stack, TextField } from '@mui/material';
|
|
18
18
|
import { NodeViewContent, NodeViewWrapper } from '@tiptap/react';
|
|
19
|
-
import React, { useCallback, useState } from 'react';
|
|
19
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
20
|
import ReadonlyCodeBlock from "./Readonly";
|
|
21
21
|
var CodeBlockView = function CodeBlockView(props) {
|
|
22
22
|
var node = props.node,
|
|
@@ -39,9 +39,9 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
39
39
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
40
40
|
searchText = _useState8[0],
|
|
41
41
|
setSearchText = _useState8[1];
|
|
42
|
-
var menuListRef =
|
|
42
|
+
var menuListRef = useRef(null);
|
|
43
43
|
var attrs = node.attrs;
|
|
44
|
-
var filteredLanguages =
|
|
44
|
+
var filteredLanguages = useMemo(function () {
|
|
45
45
|
if (!searchText) return languages;
|
|
46
46
|
var lowerSearch = searchText.toLowerCase();
|
|
47
47
|
return languages.filter(function (lang) {
|
|
@@ -50,7 +50,7 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
50
50
|
}, [searchText]);
|
|
51
51
|
|
|
52
52
|
// 当搜索文本改变时,重置滚动位置
|
|
53
|
-
|
|
53
|
+
useEffect(function () {
|
|
54
54
|
if (menuListRef.current) {
|
|
55
55
|
menuListRef.current.scrollTop = 0;
|
|
56
56
|
}
|
|
@@ -62,7 +62,7 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
62
62
|
}, [updateAttributes]);
|
|
63
63
|
var handleCopy = useCallback( /*#__PURE__*/function () {
|
|
64
64
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
65
|
-
var codeText;
|
|
65
|
+
var codeText, timer;
|
|
66
66
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
67
|
while (1) switch (_context.prev = _context.next) {
|
|
68
68
|
case 0:
|
|
@@ -74,20 +74,21 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
74
74
|
return navigator.clipboard.writeText(codeText);
|
|
75
75
|
case 6:
|
|
76
76
|
setCopyText('复制成功');
|
|
77
|
-
setTimeout(function () {
|
|
77
|
+
timer = setTimeout(function () {
|
|
78
78
|
setCopyText('复制');
|
|
79
79
|
}, 2000);
|
|
80
|
-
_context.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
return _context.abrupt("return", function () {
|
|
81
|
+
return clearTimeout(timer);
|
|
82
|
+
});
|
|
83
|
+
case 11:
|
|
84
|
+
_context.prev = 11;
|
|
84
85
|
_context.t0 = _context["catch"](3);
|
|
85
86
|
console.error('复制失败:', _context.t0);
|
|
86
|
-
case
|
|
87
|
+
case 14:
|
|
87
88
|
case "end":
|
|
88
89
|
return _context.stop();
|
|
89
90
|
}
|
|
90
|
-
}, _callee, null, [[3,
|
|
91
|
+
}, _callee, null, [[3, 11]]);
|
|
91
92
|
}));
|
|
92
93
|
return function (_x) {
|
|
93
94
|
return _ref.apply(this, arguments);
|
|
@@ -109,8 +110,10 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
109
110
|
}, [titleValue, updateAttributes]);
|
|
110
111
|
var handleTitleKeyDown = useCallback(function (event) {
|
|
111
112
|
if (event.key === 'Enter') {
|
|
113
|
+
event.preventDefault();
|
|
112
114
|
handleTitleSubmit();
|
|
113
115
|
} else if (event.key === 'Escape') {
|
|
116
|
+
event.preventDefault();
|
|
114
117
|
setTitleValue(attrs.title || '');
|
|
115
118
|
setShowTitleInput(false);
|
|
116
119
|
}
|
|
@@ -122,11 +125,11 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
122
125
|
className: "codeblock-wrapper ".concat(selected ? 'ProseMirror-selectednode' : ''),
|
|
123
126
|
"data-drag-handle": true
|
|
124
127
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
125
|
-
component: "pre",
|
|
126
128
|
sx: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
position: 'relative',
|
|
130
|
+
border: '1px solid',
|
|
131
|
+
borderColor: 'divider',
|
|
132
|
+
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
130
133
|
overflow: 'hidden'
|
|
131
134
|
}
|
|
132
135
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -135,14 +138,25 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
135
138
|
justifyContent: "space-between",
|
|
136
139
|
className: "codeblock-toolbar",
|
|
137
140
|
sx: {
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
top: 0,
|
|
143
|
+
left: 0,
|
|
144
|
+
right: 0,
|
|
145
|
+
height: '1.25rem',
|
|
146
|
+
lineHeight: '1.25rem',
|
|
147
|
+
px: 2.5,
|
|
148
|
+
py: 2,
|
|
138
149
|
zIndex: 1,
|
|
139
|
-
|
|
150
|
+
color: 'text.tertiary',
|
|
151
|
+
borderBottom: '1px solid',
|
|
152
|
+
borderColor: 'divider'
|
|
140
153
|
}
|
|
141
154
|
}, showTitleInput ? /*#__PURE__*/React.createElement(Box, {
|
|
142
155
|
sx: {
|
|
143
|
-
py: 0.5,
|
|
144
156
|
flex: 1,
|
|
145
|
-
|
|
157
|
+
height: '1.25rem',
|
|
158
|
+
lineHeight: '1.25rem',
|
|
159
|
+
borderRadius: '4px',
|
|
146
160
|
bgcolor: 'background.paper3',
|
|
147
161
|
boxSizing: 'border-box',
|
|
148
162
|
letterSpacing: '0.01rem'
|
|
@@ -159,8 +173,8 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
159
173
|
sx: {
|
|
160
174
|
'& .MuiInputBase-input': {
|
|
161
175
|
p: 0,
|
|
162
|
-
height: '
|
|
163
|
-
lineHeight: 1,
|
|
176
|
+
height: '1.25rem',
|
|
177
|
+
lineHeight: '1.25rem',
|
|
164
178
|
fontSize: '0.875rem',
|
|
165
179
|
color: 'text.tertiary'
|
|
166
180
|
},
|
|
@@ -179,7 +193,6 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
179
193
|
sx: {
|
|
180
194
|
flex: 1,
|
|
181
195
|
fontSize: '0.875rem',
|
|
182
|
-
color: 'text.tertiary',
|
|
183
196
|
letterSpacing: '0.01rem'
|
|
184
197
|
},
|
|
185
198
|
onClick: handleTitleToggle
|
|
@@ -187,6 +200,7 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
187
200
|
direction: "row",
|
|
188
201
|
alignItems: "center",
|
|
189
202
|
sx: {
|
|
203
|
+
fontSize: '0.75rem',
|
|
190
204
|
flexShrink: 0
|
|
191
205
|
}
|
|
192
206
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
@@ -298,7 +312,7 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
298
312
|
orientation: "vertical",
|
|
299
313
|
flexItem: true,
|
|
300
314
|
sx: {
|
|
301
|
-
height: '
|
|
315
|
+
height: '1rem',
|
|
302
316
|
alignSelf: 'center',
|
|
303
317
|
borderColor: 'divider'
|
|
304
318
|
}
|
|
@@ -312,27 +326,34 @@ var CodeBlockView = function CodeBlockView(props) {
|
|
|
312
326
|
py: 0.5,
|
|
313
327
|
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
314
328
|
cursor: 'pointer',
|
|
315
|
-
'
|
|
316
|
-
|
|
317
|
-
|
|
329
|
+
userSelect: 'none',
|
|
330
|
+
bgcolor: 'inherit',
|
|
331
|
+
color: 'inherit'
|
|
318
332
|
}
|
|
319
333
|
}, /*#__PURE__*/React.createElement(FileCopyLineIcon, {
|
|
320
334
|
sx: {
|
|
321
|
-
fontSize: '0.
|
|
335
|
+
fontSize: '0.75rem',
|
|
322
336
|
color: 'inherit'
|
|
323
337
|
}
|
|
324
338
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
325
339
|
sx: {
|
|
326
|
-
fontSize: '0.75rem',
|
|
327
340
|
lineHeight: 1
|
|
328
341
|
}
|
|
329
|
-
}, copyText)))), /*#__PURE__*/React.createElement(
|
|
342
|
+
}, copyText)))), /*#__PURE__*/React.createElement(Box, {
|
|
343
|
+
component: 'pre',
|
|
344
|
+
sx: {
|
|
345
|
+
m: 0
|
|
346
|
+
}
|
|
347
|
+
}, /*#__PURE__*/React.createElement(NodeViewContent, {
|
|
348
|
+
as: "code",
|
|
349
|
+
className: "hljs",
|
|
330
350
|
style: {
|
|
331
|
-
|
|
351
|
+
padding: '3rem 1.25rem 0.75rem 1.25rem',
|
|
332
352
|
fontSize: '0.875rem',
|
|
353
|
+
lineHeight: '1.5',
|
|
333
354
|
whiteSpace: 'pre-wrap',
|
|
334
355
|
wordBreak: 'break-word'
|
|
335
356
|
}
|
|
336
|
-
})));
|
|
357
|
+
}))));
|
|
337
358
|
};
|
|
338
359
|
export default CodeBlockView;
|
|
@@ -11,6 +11,7 @@ import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
|
11
11
|
import { all, createLowlight } from 'lowlight';
|
|
12
12
|
import CodeBlockView from "../component/CodeBlock";
|
|
13
13
|
var lowlight = createLowlight(all);
|
|
14
|
+
console.log(lowlight.listLanguages());
|
|
14
15
|
var CustomCodeBlock = CodeBlockLowlight.configure({
|
|
15
16
|
enableTabIndentation: true,
|
|
16
17
|
tabSize: 1,
|
package/dist/index.css
CHANGED
|
@@ -208,53 +208,6 @@
|
|
|
208
208
|
margin: 0;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
/* code */
|
|
212
|
-
.tiptap.ProseMirror .codeblock-wrapper {
|
|
213
|
-
margin: 20px 0;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.tiptap.ProseMirror pre {
|
|
217
|
-
position: relative;
|
|
218
|
-
border: 1px solid;
|
|
219
|
-
border-color: var(--mui-palette-divider);
|
|
220
|
-
border-radius: var(--mui-shape-borderRadius);
|
|
221
|
-
color: var(--mui-palette-text-tertiary);
|
|
222
|
-
background-color: var(--mui-palette-background-paper3);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.tiptap.ProseMirror pre[data-type="yaml-frontmatter"] {
|
|
226
|
-
margin-bottom: 20px;
|
|
227
|
-
border-radius: var(--mui-shape-borderRadius);
|
|
228
|
-
color: var(--mui-palette-text-disabled);
|
|
229
|
-
background-color: transparent;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
.tiptap.ProseMirror code {
|
|
233
|
-
padding: 2px 8px;
|
|
234
|
-
margin: 0 4px;
|
|
235
|
-
word-break: break-all;
|
|
236
|
-
/* font-weight: 500; */
|
|
237
|
-
border: 1px solid;
|
|
238
|
-
border-color: var(--mui-palette-divider);
|
|
239
|
-
background-color: var(--mui-palette-background-paper3);
|
|
240
|
-
border-radius: 6px;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.tiptap.ProseMirror pre[data-type="yaml-frontmatter"] code {
|
|
244
|
-
border: none;
|
|
245
|
-
margin: 0;
|
|
246
|
-
display: inline-block;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.tiptap.ProseMirror pre code {
|
|
250
|
-
color: inherit;
|
|
251
|
-
padding: 0;
|
|
252
|
-
font-weight: normal;
|
|
253
|
-
border-radius: 0;
|
|
254
|
-
background-color: transparent;
|
|
255
|
-
-webkit-text-fill-color: inherit;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
211
|
/* details */
|
|
259
212
|
.tiptap.ProseMirror .cq-details {
|
|
260
213
|
display: flex;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { default as EditorDiff } from './EditorDiff';
|
|
|
4
4
|
export { default as EditorMarkdown, type MarkdownEditorRef } from './EditorMarkdown';
|
|
5
5
|
export { default as EditorThemeProvider } from './EditorThemeProvider';
|
|
6
6
|
export { default as EditorToolbar } from './EditorToolbar';
|
|
7
|
+
export { getExtensions } from './extension';
|
|
7
8
|
export { default as useTiptap } from './hook';
|
|
8
9
|
export { useFn } from './hook/fn';
|
|
9
10
|
export * from './type';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as EditorDiff } from "./EditorDiff";
|
|
|
4
4
|
export { default as EditorMarkdown } from "./EditorMarkdown";
|
|
5
5
|
export { default as EditorThemeProvider } from "./EditorThemeProvider";
|
|
6
6
|
export { default as EditorToolbar } from "./EditorToolbar";
|
|
7
|
+
export { getExtensions } from "./extension";
|
|
7
8
|
export { default as useTiptap } from "./hook";
|
|
8
9
|
export { useFn } from "./hook/fn";
|
|
9
10
|
export * from "./type";
|