Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我的 vue3 项目中直接引入报错,完全按照官网的配置说明操作 #12

Open
FullStackPlayer opened this issue Dec 18, 2024 · 8 comments

Comments

@FullStackPlayer
Copy link

很喜欢并且比较看好这个编辑器,因为它功能适度、设计合理、兼容各前端框架,但是第一下尝试就给了当头一棒。

先说说我的环境:
vscode 连接 ubuntu 22 进行远程开发,项目环境是 node 20.18 + ts 5.5.3 + vite 5.4.1 + vue3.4.37,整个项目一切顺利,直到我引入 xnote 报错了:
image

我的代码如下:
image
非常简单,就是一个空组件试图实例化一个 xnote

在此之前,我已经按照文档说明先安装了 @textbus/xnote,因为报错,又根据 github 仓库的 readme 添加了 katex 后来甚至根据 textbus 文档又加了 @textbus/adapter-vue,依然如此。

说实话有点无助,因为文档不足,没有用户群,也联系不到作者本人(哪怕给个邮箱呢),而我又比较着急必须尽快确定富文本编辑器的技术选型,目前只能先发 issue 了,期望能看到作者尽快回复,谢谢。

@FullStackPlayer
Copy link
Author

补充一下,vite 控制台还有如下提示:
7:50:01 PM [vite] vite.config.ts changed, restarting server... 7:50:01 PM [vite] server restarted. [vite:css] @import must precede all other statements (besides @charset or empty @layer) 22 | Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less 23 | Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less 24 | */}.xnote-source-code.stackoverflow-light pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.stackoverflow-light code.hljs{padding:3px 5px}.xnote-source-code.stackoverflow-light .hljs{background:#f6f6f6;color:#2f3337}.xnote-source-code.stackoverflow-light .hljs-subst{color:#2f3337}.xnote-source-code.stackoverflow-light .hljs-comment{color:#656e77}.xnote-source-code.stackoverflow-light .hljs-attr,.xnote-source-code.stackoverflow-light .hljs-doctag,.xnote-source-code.stackoverflow-light .hljs-keyword,.xnote-source-code.stackoverflow-light .hljs-meta .hljs-keyword,.xnote-source-code.stackoverflow-light .hljs-section,.xnote-source-code.stackoverflow-light .hljs-selector-tag{color:#015692}.xnote-source-code.stackoverflow-light .hljs-attribute{color:#803378}.xnote-source-code.stackoverflow-light .hljs-name,.xnote-source-code.stackoverflow-light .hljs-number,.xnote-source-code.stackoverflow-light .hljs-quote,.xnote-source-code.stackoverflow-light .hljs-selector-id,.xnote-source-code.stackoverflow-light .hljs-template-tag,.xnote-source-code.stackoverflow-light .hljs-type{color:#b75501}.xnote-source-code.stackoverflow-light .hljs-selector-class{color:#015692}.xnote-source-code.stackoverflow-light .hljs-link,.xnote-source-code.stackoverflow-light .hljs-regexp,.xnote-source-code.stackoverflow-light .hljs-selector-attr,.xnote-source-code.stackoverflow-light .hljs-string,.xnote-source-code.stackoverflow-light .hljs-symbol,.xnote-source-code.stackoverflow-light .hljs-template-variable,.xnote-source-code.stackoverflow-light .hljs-variable{color:#54790d}.xnote-source-code.stackoverflow-light .hljs-meta,.xnote-source-code.stackoverflow-light .hljs-selector-pseudo{color:#015692}.xnote-source-code.stackoverflow-light .hljs-built_in,.xnote-source-code.stackoverflow-light .hljs-literal,.xnote-source-code.stackoverflow-light .hljs-title{color:#b75501}.xnote-source-code.stackoverflow-light .hljs-bullet,.xnote-source-code.stackoverflow-light .hljs-code{color:#535a60}.xnote-source-code.stackoverflow-light .hljs-meta .hljs-string{color:#54790d}.xnote-source-code.stackoverflow-light .hljs-deletion{color:#c02d2e}.xnote-source-code.stackoverflow-light .hljs-addition{color:#2f6f44}.xnote-source-code.stackoverflow-light .hljs-emphasis{font-style:italic}.xnote-source-code.stackoverflow-light .hljs-strong{font-weight:700}.xnote-source-code.vs2015 pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.vs2015 code.hljs{padding:3px 5px}.xnote-source-code.vs2015 .hljs{background:#1e1e1e;color:#dcdcdc}.xnote-source-code.vs2015 .hljs-keyword,.xnote-source-code.vs2015 .hljs-literal,.xnote-source-code.vs2015 .hljs-name,.xnote-source-code.vs2015 .hljs-symbol{color:#569cd6}.xnote-source-code.vs2015 .hljs-link{color:#569cd6;text-decoration:underline}.xnote-source-code.vs2015 .hljs-built_in,.xnote-source-code.vs2015 .hljs-type{color:#4ec9b0}.xnote-source-code.vs2015 .hljs-class,.xnote-source-code.vs2015 .hljs-number{color:#b8d7a3}.xnote-source-code.vs2015 .hljs-meta .hljs-string,.xnote-source-code.vs2015 .hljs-string{color:#d69d85}.xnote-source-code.vs2015 .hljs-regexp,.xnote-source-code.vs2015 .hljs-template-tag{color:#9a5334}.xnote-source-code.vs2015 .hljs-formula,.xnote-source-code.vs2015 .hljs-function,.xnote-source-code.vs2015 .hljs-params,.xnote-source-code.vs2015 .hljs-subst,.xnote-source-code.vs2015 .hljs-title{color:#dcdcdc}.xnote-source-code.vs2015 .hljs-comment,.xnote-source-code.vs2015 .hljs-quote{color:#57a64a;font-style:italic}.xnote-source-code.vs2015 .hljs-doctag{color:#608b4e}.xnote-source-code.vs2015 .hljs-meta,.xnote-source-code.vs2015 .hljs-meta .hljs-keyword,.xnote-source-code.vs2015 .hljs-tag{color:#9b9b9b}.xnote-source-code.vs2015 .hljs-template-variable,.xnote-source-code.vs2015 .hljs-variable{color:#bd63c5}.xnote-source-code.vs2015 .hljs-attr,.xnote-source-code.vs2015 .hljs-attribute{color:#9cdcfe}.xnote-source-code.vs2015 .hljs-section{color:gold}.xnote-source-code.vs2015 .hljs-emphasis{font-style:italic}.xnote-source-code.vs2015 .hljs-strong{font-weight:700}.xnote-source-code.vs2015 .hljs-bullet,.xnote-source-code.vs2015 .hljs-selector-attr,.xnote-source-code.vs2015 .hljs-selector-class,.xnote-source-code.vs2015 .hljs-selector-id,.xnote-source-code.vs2015 .hljs-selector-pseudo,.xnote-source-code.vs2015 .hljs-selector-tag{color:#d7ba7d}.xnote-source-code.vs2015 .hljs-addition{background-color:#144212;display:inline-block;width:100%}.xnote-source-code.vs2015 .hljs-deletion{background-color:#600;display:inline-block;width:100%}.xnote-source-code.xcode .xnote-source-code-container{border:1px solid #eee}.xnote-source-code.xcode .xnote-source-code-line-number-bg{background-color:#fafafa}.xnote-source-code.xcode pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.xcode code.hljs{padding:3px 5px}.xnote-source-code.xcode .hljs{background:#fff;color:#000}.xnote-source-code.xcode .xml .hljs-meta{color:silver}.xnote-source-code.xcode .hljs-comment,.xnote-source-code.xcode .hljs-quote{color:#007400}.xnote-source-code.xcode .hljs-attribute,.xnote-source-code.xcode .hljs-keyword,.xnote-source-code.xcode .hljs-literal,.xnote-source-code.xcode .hljs-name,.xnote-source-code.xcode .hljs-selector-tag,.xnote-source-code.xcode .hljs-tag{color:#aa0d91}.xnote-source-code.xcode .hljs-template-variable,.xnote-source-code.xcode .hljs-variable{color:#3f6e74}.xnote-source-code.xcode .hljs-code,.xnote-source-code.xcode .hljs-meta .hljs-string,.xnote-source-code.xcode .hljs-string{color:#c41a16}.xnote-source-code.xcode .hljs-link,.xnote-source-code.xcode .hljs-regexp{color:#0e0eff}.xnote-source-code.xcode .hljs-bullet,.xnote-source-code.xcode .hljs-number,.xnote-source-code.xcode .hljs-symbol,.xnote-source-code.xcode .hljs-title{color:#1c00cf}.xnote-source-code.xcode .hljs-meta,.xnote-source-code.xcode .hljs-section{color:#643820}.xnote-source-code.xcode .hljs-built_in,.xnote-source-code.xcode .hljs-class .hljs-title,.xnote-source-code.xcode .hljs-params,.xnote-source-code.xcode .hljs-title.class_,.xnote-source-code.xcode .hljs-type{color:#5c2699}.xnote-source-code.xcode .hljs-attr{color:#836c28}.xnote-source-code.xcode .hljs-subst{color:#000}.xnote-source-code.xcode .hljs-formula{background-color:#eee;font-style:italic}.xnote-source-code.xcode .hljs-addition{background-color:#baeeba}.xnote-source-code.xcode .hljs-deletion{background-color:#ffc8bd}.xnote-source-code.xcode .hljs-selector-class,.xnote-source-code.xcode .hljs-selector-id{color:#9b703f}.xnote-source-code.xcode .hljs-doctag,.xnote-source-code.xcode .hljs-strong{font-weight:700}.xnote-source-code.xcode .hljs-emphasis{font-style:italic}.xnote-source-code.xnote-dark pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.xnote-dark code.hljs{padding:3px 5px}.xnote-source-code.xnote-dark .hljs{background:#182324;color:#a9aeb2}.xnote-source-code.xnote-dark .hljs-comment,.xnote-source-code.xnote-dark .hljs-quote{color:#5c6d6e;font-style:italic}.xnote-source-code.xnote-dark .hljs-doctag,.xnote-source-code.xnote-dark .hljs-formula,.xnote-source-code.xnote-dark .hljs-keyword{color:#71b155;font-weight:700}.xnote-source-code.xnote-dark .hljs-deletion,.xnote-source-code.xnote-dark .hljs-section,.xnote-source-code.xnote-dark .hljs-selector-tag{color:#e06c75}.xnote-source-code.xnote-dark .hljs-literal{color:#388138}.xnote-source-code.xnote-dark .hljs-addition,.xnote-source-code.xnote-dark .hljs-attribute,.xnote-source-code.xnote-dark .hljs-meta .hljs-string,.xnote-source-code.xnote-dark .hljs-regexp,.xnote-source-code.xnote-dark .hljs-string{color:#dd7600}.xnote-source-code.xnote-dark .hljs-number,.xnote-source-code.xnote-dark .hljs-selector-attr,.xnote-source-code.xnote-dark .hljs-selector-class,.xnote-source-code.xnote-dark .hljs-selector-pseudo,.xnote-source-code.xnote-dark .hljs-template-variable,.xnote-source-code.xnote-dark .hljs-type,.xnote-source-code.xnote-dark .hljs-variable{color:#388138}.xnote-source-code.xnote-dark .hljs-bullet,.xnote-source-code.xnote-dark .hljs-link,.xnote-source-code.xnote-dark .hljs-meta,.xnote-source-code.xnote-dark .hljs-name,.xnote-source-code.xnote-dark .hljs-selector-id,.xnote-source-code.xnote-dark .hljs-subst,.xnote-source-code.xnote-dark .hljs-symbol,.xnote-source-code.xnote-dark .hljs-title{color:#2e89c1}.xnote-source-code.xnote-dark .hljs-built_in,.xnote-source-code.xnote-dark .hljs-class .hljs-title,.xnote-source-code.xnote-dark .hljs-title.class_{color:#e6c07b}.xnote-source-code.xnote-dark .hljs-emphasis{font-style:italic}.xnote-source-code.xnote-dark .hljs-strong{font-weight:700}.xnote-source-code.xnote-dark .hljs-link{text-decoration:underline}.xnote-source-code.xnote-dark-blue pre code.hljs{display:block;overflow-x:auto;padding:1em}.xnote-source-code.xnote-dark-blue code.hljs{padding:3px 5px}.xnote-source-code.xnote-dark-blue .hljs{background:#1c222a;color:#a9aeb2}.xnote-source-code.xnote-dark-blue .hljs-comment,.xnote-source-code.xnote-dark-blue .hljs-quote{color:#5c6d6e;font-style:italic}.xnote-source-code.xnote-dark-blue .hljs-doctag,.xnote-source-code.xnote-dark-blue .hljs-formula,.xnote-source-code.xnote-dark-blue .hljs-keyword{color:#0086b3;font-weight:700}.xnote-source-code.xnote-dark-blue .hljs-deletion,.xnote-source-code.xnote-dark-blue .hljs-section,.xnote-source-code.xnote-dark-blue .hljs-selector-tag{color:#e06c75}.xnote-source-code.xnote-dark-blue .hljs-literal{color:#388138}.xnote-source-code.xnote-dark-blue .hljs-addition,.xnote-source-code.xnote-dark-blue .hljs-attribute,.xnote-source-code.xnote-dark-blue .hljs-meta .hljs-string,.xnote-source-code.xnote-dark-blue .hljs-regexp,.xnote-source-code.xnote-dark-blue .hljs-string{color:#ce5a70}.xnote-source-code.xnote-dark-blue .hljs-number,.xnote-source-code.xnote-dark-blue .hljs-selector-attr,.xnote-source-code.xnote-dark-blue .hljs-selector-class,.xnote-source-code.xnote-dark-blue .hljs-selector-pseudo,.xnote-source-code.xnote-dark-blue .hljs-template-variable,.xnote-source-code.xnote-dark-blue .hljs-type,.xnote-source-code.xnote-dark-blue .hljs-variable{color:#388138}.xnote-source-code.xnote-dark-blue .hljs-bullet,.xnote-source-code.xnote-dark-blue .hljs-link,.xnote-source-code.xnote-dark-blue .hljs-meta,.xnote-source-code.xnote-dark-blue .hljs-name,.xnote-source-code.xnote-dark-blue .hljs-selector-id,.xnote-source-code.xnote-dark-blue .hljs-subst,.xnote-source-code.xnote-dark-blue .hljs-symbol,.xnote-source-code.xnote-dark-blue .hljs-title{color:#2e89c1}.xnote-source-code.xnote-dark-blue .hljs-built_in,.xnote-source-code.xnote-dark-blue .hljs-class .hljs-title,.xnote-source-code.xnote-dark-blue .hljs-title.class_{color:#399fcf}.xnote-source-code.xnote-dark-blue .hljs-emphasis{font-style:italic}.xnote-source-code.xnote-dark-blue .hljs-strong{font-weight:700}.xnote-source-code.xnote-dark-blue .hljs-link{text-decoration:underline}.xnote-source-code code{background:none;border:none;border-radius:0;padding:0;vertical-align:inherit}.xnote-source-code{margin-bottom:16px;margin-top:16px;position:relative}.xnote-source-code-container{border-radius:5px;display:flex;line-height:1.418em;overflow:hidden;position:relative}.xnote-source-code-container.xnote-source-code-auto-break .xnote-source-code-line{word-wrap:break-word;white-space:pre-wrap;word-break:break-all}code,kbd,pre,samp{font-family:Microsoft YaHei Mono,Menlo,Monaco,Consolas,Courier New,monospace}.xnote-source-code-line-number-bg{background-color:inherit;display:none;position:relative;width:3em;z-index:2}.xnote-source-code.xnote-source-code-line-number .xnote-source-code-line-number-bg{display:block}.xnote-source-code.xnote-source-code-line-number .xnote-source-code-line{margin-left:-4em}.xnote-source-code-content{counter-reset:codeNum;flex:1;font-size:15px;margin:0;max-height:450px;overflow:auto;padding:15px 0;position:relative}.xnote-source-code-content:hover::-webkit-scrollbar-thumb{background-color:#80848f}.xnote-source-code-content::-webkit-scrollbar-thumb{border:0;border-radius:4px;height:50px;outline:0;outline-offset:0}.xnote-source-code-content::-webkit-scrollbar-thumb:hover{background-color:#495060;height:50px}.xnote-source-code-content::-webkit-scrollbar{border-radius:3px;height:6px;width:6px}.xnote-source-code-content-highlight .xnote-source-code-line{opacity:.36}.xnote-source-code-line{display:flex;margin:2px 0}.xnote-source-code-line-content{display:block;padding:0 20px}.xnote-source-code-line-number .xnote-source-code-line-content{padding:0 20px 0 10px}.xnote-source-code-line-number .xnote-source-code-line:before{box-sizing:border-box;content:counter(codeNum);counter-increment:codeNum;left:0;min-width:4em;opacity:.5;overflow:hidden;padding-right:10px;position:sticky;text-align:right;transform:translateX(-4em);white-space:nowrap;z-index:2}.xnote-source-code-content-highlight .xnote-source-code-line-emphasize{opacity:1}.xnote-source-code-lang{font-size:13px;opacity:.5;padding:4px 10px;pointer-events:none;position:absolute;right:0;top:0}.xnote-paragraph{margin:8px 0}.xnote-blockquote{border-left:2px solid #296eff;margin:1em 0;padding:0 15px}.xnote-blockquote>:first-child{margin-top:0}.xnote-blockquote>:last-child{margin-bottom:0}.xnote-highlight-box{background:#fcf5ce;border:1px solid #f5c774;border-radius:4px;display:flex;margin:16px 0}.xnote-highlight-box-left{padding-top:.65em;text-align:center;width:40px}.xnote-highlight-box-content{flex:1;width:0}.xnote-highlight-box-icon{user-select:none}.xnote-highlight-box-icon button{background:none;border:none;border-radius:4px;cursor:pointer;font-size:1.2em;height:30px;padding:0;width:30px}.xnote-highlight-box-icon button:hover{background:rgba(0,0,0,.1)}.xnote-highlight-box-icons{text-align:left}.xnote-highlight-box-icons button{background:none;border:none;border-radius:4px;cursor:pointer;font-size:22px;height:30px;padding:0;width:30px}.xnote-highlight-box-icons button:hover{background:rgba(0,0,0,.1)}.xnote-highlight-box-content{padding:5px}.xnote-highlight-box-heading{font-size:14px;opacity:.8;padding:10px 0 10px 3px}.xnote-image{display:inline-block}.xnote-image,.xnote-image img,.xnote-video{max-width:100%}.xnote-video{display:inline-block}.xnote-video video{max-width:100%}.xnote-todolist{align-items:center;display:flex;margin:8px 0}.xnote-todolist-icon{color:#296eff;cursor:pointer;margin-right:6px}.xnote-todolist-content{min-width:2em}.xnote-todolist-content[style*=text-indent]{text-indent:0!important}.xnote-todolist-content[style*=text-align]{text-align:left!important}.xnote-list{margin:8px 0;padding:0}.xnote-list>li{display:flex}.xnote-list-content{min-width:2em}ul.xnote-list .xnote-list-type{font-family:initial;font-size:16px}.xnote-list-type{box-sizing:border-box;color:#296eff;flex-shrink:0;text-align:left;text-indent:0;user-select:none;white-space:nowrap;width:24px}.xnote-order-btn{padding-left:5px}.xnote-list-content[style*=text-indent]{text-indent:0!important}.xnote-list-content[style*=text-align]{text-align:left!important}.btn-group[vf-cf8e1c]{font-size:15px;padding:5px 0;text-align:center}.btn-group button[vf-cf8e1c]{margin:2px 5px}@import "~katex/dist/katex.min.css";.katex,.katex-display,.katex-html,.xnote-katex{display:inline-block}.xnote-katex{margin-left:.5em;margin-right:.5em}.xnote-katex-input{inset:0;min-height:300px;position:absolute;width:590px}.xnote-katex-input .xnote-source-code{margin:0;overflow:hidden;user-select:text}.xnote-katex-input .xnote-source-code-container{border:0!important;height:100%}.xnote-katex-input .xnote-source-code-content{box-sizing:border-box;max-height:none;min-height:300px;overflow:hidden}.input-group[vf-e74208]{display:flex;padding:5px 10px}.input-group input[vf-e74208]{border:1px solid #ddd;border-radius:4px;font-size:14px;margin-right:5px;outline:none;padding:2px 6px}.input-group input[vf-e74208]:focus{border-color:#296eff}.input-group button[vf-e74208]{border:1px solid #ddd;border-radius:4px;font-size:14px}.split-line[vf-669084]{background:#ddd;margin:8px 5px;width:1px}.left-toolbar[vf-b05292]{font-size:15px;left:-10px;position:absolute;top:0;z-index:10}.left-toolbar-btn-wrap[vf-b05292]{position:absolute;transition:all .2s}.left-toolbar-btn[vf-b05292]{background:#fff;border:1px solid #ddd;border-radius:5px;cursor:pointer;height:26px}.left-toolbar-btn span[vf-b05292]{align-items:center;display:inline-flex}.btn-group[vf-b05292]{font-size:15px;padding:5px 0;text-align:center}.btn-group button[vf-b05292]{margin:2px 5px}.link-jump-plugin[vf-3073ba]{background-color:#333;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.3);color:#ddd;font-size:12px;line-height:1em;margin-top:-30px;padding:6px 0;position:absolute;text-align:center;text-decoration:none;transform:translateX(-50%);width:66px}.link-jump-plugin a[vf-3073ba],.link-jump-plugin span[vf-3073ba]{color:inherit;cursor:pointer;margin-left:2px;margin-right:2px;text-decoration:none}.link-jump-plugin a[vf-3073ba]:hover,.link-jump-plugin span[vf-3073ba]:hover{color:#296eff}.link-jump-plugin[vf-3073ba]:after{border:6px solid transparent;border-top-color:#333;content:"";left:50%;margin-left:-6px;pointer-events:none;position:absolute;top:100%}.toolbar[vf-33b3ca]{background-color:#fff;border:1px solid #dee0e3;border-radius:5px;box-shadow:0 4px 8px rgba(0,0,0,.08);box-sizing:border-box;display:flex;font-size:13px;height:36px;opacity:0;padding:0 6px;pointer-events:none;position:absolute;text-align:left;transform:translateX(-50%);transition-duration:.4s;transition-property:all;transition-timing-function:ease;z-index:3}.toolbar.dark[vf-33b3ca]{background-color:#222;color:#ccc}.toolbar.dark[vf-33b3ca] .split-line{background:#666}.toolbar.dark[vf-33b3ca] .btn.active,.toolbar.dark[vf-33b3ca] .btn:hover{background-color:hsla(0,0%,100%,.2)}.toolbar[vf-42c12d]{border-radius:inherit;box-sizing:border-box;color:#000;display:flex;font-size:13px;padding:3px 15px;position:relative;text-align:left;top:0;z-index:3}.toolbar.dark[vf-42c12d]{background-color:#222;color:#ccc}.toolbar.dark[vf-42c12d] .split-line{background:#666}.toolbar.dark[vf-42c12d] .btn.active,.toolbar.dark[vf-42c12d] .btn:hover{background-color:hsla(0,0%,100%,.2)}.toolbar[vf-25fd9c]{background:#fff;border:1px solid #dee0e3;border-radius:5px;box-sizing:border-box;color:#000;display:flex;font-size:13px;padding:3px 10px;position:relative;text-align:left;top:0;transition-duration:.15s;transition-property:all;transition-timing-function:ease;z-index:3}.toolbar.suspension[vf-25fd9c]{box-shadow:0 4px 8px rgba(0,0,0,.08)}.toolbar.dark[vf-25fd9c]{background-color:#222;color:#ccc}.toolbar.dark[vf-25fd9c] .split-line{background:#666}.toolbar.dark[vf-25fd9c] .btn.active,.toolbar.dark[vf-25fd9c] .btn:hover{background-color:hsla(0,0%,100%,.2)}.xnote-at{color:#296eff;display:inline-block;line-height:1em}.xnote-at-complete{background-color:#296eff;border-radius:1em;color:#fff;font-size:.9em;margin-left:2px;margin-right:2px;padding:4px 6px}.xnote-at-input{display:inline-block;min-width:2em}.xnote-at-menu{user-select:none}.xnote-at-member{border-radius:4px;cursor:pointer;display:flex;height:50px;margin:4px 0;overflow:hidden;padding:5px;transition:background-color .2s;width:100%}.xnote-at-member.selected,.xnote-at-member:hover{background:#eee}.xnote-at-member-avatar{align-items:center;display:flex;font-size:12px;text-align:center;width:40px}.xnote-at-member-avatar img,.xnote-at-member-avatar-bg{background:#eee;border-radius:50%;display:inline-block;font-size:.9em;height:36px;line-height:36px;overflow:hidden;width:36px}.xnote-at-member-info{flex:1;font-size:14px;padding-left:10px;width:156px}.xnote-at-member-desc,.xnote-at-member-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xnote-at-member-desc{font-size:12px;opacity:.7}.xnote-root{color:#1f2329}.xnote-root * ::selection{background:rgba(20,99,252,.34)}.xnote-content{color:initial;font-family:initial;font-size:medium;line-height:1.65}.xnote-content:before{content:attr(data-placeholder);opacity:.5;position:absolute}.xnote-table{margin-bottom:16px;margin-top:16px}.xnote-table-inner{display:inline-block;max-width:100%;position:relative}.xnote-table-content{background:hsla(0,0%,100%,.8);border-collapse:collapse;border-spacing:0;table-layout:fixed;width:0}.xnote-table-content.hide-selection * ::selection{background:none}.xnote-table-content td{border:1px solid #ddd;box-sizing:content-box;padding:0 10px}.xnote-table-container,.xnote-table-wrapper{position:relative}.xnote-table-delete-btn{background:#eee;border:none;border-radius:4px;color:#5c6370;cursor:pointer;height:30px;line-height:30px;width:24px}.xnote-table-delete-btn:hover{color:#333}.drag-line[vf-681de2]{border-color:transparent;border-style:solid;border-width:0 5px;bottom:0;box-sizing:content-box;cursor:col-resize;display:none;margin-left:-5px;position:absolute;top:0;width:2px}.drag-line[vf-681de2]:before{background:#296eff;content:"";inset:0;position:absolute}.top-bar[vf-39cb2c]{display:none;left:0;position:absolute;right:0;top:0}.top-bar.active[vf-39cb2c]{display:block}.top-delete-toolbar[vf-39cb2c]{height:0;position:relative;top:-10px}.toolbar-wrapper[vf-39cb2c]{height:60px;left:0;pointer-events:none;position:absolute;right:0;top:-60px}.insert-bar[vf-39cb2c]{box-sizing:content-box;height:30px;margin-left:-10px;margin-right:-10px;overflow:hidden;padding-left:10px;padding-right:10px;padding-top:30px}.insert-bar table[vf-39cb2c]{border-collapse:collapse;border-spacing:0;position:relative;table-layout:fixed;z-index:1}.insert-bar table td[vf-39cb2c]{border:1px solid transparent;box-sizing:border-box;height:18px;position:relative}.insert-bar table .tool-container[vf-39cb2c]{height:18px}.insert-bar table .tool-container>div[vf-39cb2c],.insert-bar table .tool-container>span[vf-39cb2c]{pointer-events:auto}.insert-bar table .insert-btn-wrap[vf-39cb2c]{cursor:pointer;height:21px;position:absolute;right:-11px;top:-2px;width:21px;z-index:1}.insert-bar table .insert-btn-wrap .insert-btn[vf-39cb2c]{background:#ccc;border:none;border-radius:50%;box-shadow:none;color:#fff;cursor:inherit;font-size:16px;height:100%;line-height:20px;padding:0;position:relative;text-align:center;transform:scale(.2);transition:transform .15s;width:100%}.insert-bar table .insert-btn-wrap .insert-btn[vf-39cb2c]:after{background:inherit;content:"";height:10px;left:5.5px;position:absolute;top:12px;transform:rotate(45deg);width:10px;z-index:-1}.insert-bar table .insert-btn-wrap:hover .insert-btn[vf-39cb2c]{background:#296eff;transform:scale(1)}.action-bar[vf-39cb2c]{margin-top:-12px;overflow:hidden;pointer-events:auto;position:relative;z-index:0}.action-bar.active[vf-39cb2c]{display:block}.action-bar table[vf-39cb2c]{border-collapse:collapse;border-radius:4px 4px 0 0;border-spacing:0;overflow:hidden;table-layout:fixed}.action-bar table td[vf-39cb2c]{background:#eee;border:1px solid #eee;box-sizing:border-box;cursor:pointer;height:12px;position:relative}.action-bar table td[vf-39cb2c]:hover{background:#dedede}.action-bar table td.active[vf-39cb2c]{background:#296eff;border-color:#2358c9}.action-bar table td.active[vf-39cb2c]:before{border-color:inherit;border-style:solid;border-width:0 0 0 1px;bottom:0;content:"";left:-1px;position:absolute;top:-1px}.scroll-container[vf-7bef30]{overflow-x:auto;overflow-y:hidden}.scroll-container[vf-7bef30]:hover::-webkit-scrollbar-thumb{background-color:#80848f}.scroll-container[vf-7bef30]::-webkit-scrollbar-thumb{border:0;border-radius:4px;height:50px;outline:0;outline-offset:0}.scroll-container[vf-7bef30]::-webkit-scrollbar-thumb:hover{background-color:#495060;height:50px}.scroll-container[vf-7bef30]::-webkit-scrollbar{border-radius:3px;height:6px;width:6px}.scroll-container[vf-7bef30]:before{background-image:linear-gradient(90deg,rgba(0,0,0,.1),transparent);border-left:1px solid #ddd;left:0;z-index:1}.scroll-container[vf-7bef30]:after,.scroll-container[vf-7bef30]:before{bottom:6px;content:"";pointer-events:none;position:absolute;top:0;width:12px}.scroll-container[vf-7bef30]:after{background:linear-gradient(90deg,transparent,rgba(0,0,0,.1));border-right:1px solid #ddd;right:0}.scroll-container.left-end[vf-7bef30]:before,.scroll-container.right-end[vf-7bef30]:after{display:none}.left-bar[vf-aaece0]{display:none;left:0;margin-left:-30px;position:absolute;top:0;width:30px}.left-bar.active[vf-aaece0]{display:flex}.toolbar-item[vf-aaece0]{align-items:center;display:flex;inset:0;position:absolute}.insert-bar[vf-aaece0]{width:18px}.insert-bar table[vf-aaece0]{border-collapse:collapse;border-spacing:0;table-layout:fixed}.insert-bar table td[vf-aaece0]{border:1px solid transparent;position:relative}.insert-bar table .insert-btn-wrap[vf-aaece0]{bottom:-8px;cursor:pointer;height:21px;left:0;position:absolute;width:21px;z-index:1}.insert-bar table .insert-btn-wrap .insert-btn[vf-aaece0]{background:#ccc;border:none;border-radius:50%;box-shadow:none;color:#fff;cursor:inherit;font-size:16px;height:100%;line-height:20px;padding:0;position:relative;text-align:center;transform:scale(.2);transition:transform .15s;width:100%}.insert-bar table .insert-btn-wrap .insert-btn[vf-aaece0]:after{background:inherit;content:"";height:10px;left:11px;position:absolute;top:5.5px;transform:rotate(45deg);width:10px;z-index:-1}.insert-bar table .insert-btn-wrap:hover .insert-btn[vf-aaece0]{background:#296eff;transform:scale(1)}.action-bar[vf-aaece0]{width:12px}.action-bar table[vf-aaece0]{border-collapse:collapse;border-radius:4px 0 0 4px;border-spacing:0;overflow:hidden;table-layout:fixed;width:13px}.action-bar table td[vf-aaece0]{background:#eee;border:1px solid #eee;box-sizing:border-box;cursor:pointer;height:12px;position:relative}.action-bar table td[vf-aaece0]:hover{background:#dedede}.action-bar table td.active[vf-aaece0]{background:#296eff;border-color:#2358c9}.action-bar table td.active[vf-aaece0]:before{border-color:inherit;border-style:solid;border-width:1px 0 0;content:"";left:-1px;position:absolute;right:-1px;top:-1px}.drag-line[vf-d4c4a9]{background:#296eff;contain:layout size style;height:2px;left:0;max-width:100%;position:absolute;right:0;z-index:1}.mask[vf-4a5ad1]{background:rgba(41,110,255,.063);border:1px solid #296eff;box-sizing:content-box;display:none;pointer-events:none;position:absolute}.mask.active[vf-4a5ad1]{display:block}@font-face{font-display:block;font-family:textbus;font-style:normal;font-weight:400;src:url(fonts/textbus.ttf?oyolf2) format("truetype"),url(fonts/textbus.woff?oyolf2) format("woff"),url(fonts/textbus.svg?oyolf2#textbus) format("svg")}[class*=" xnote-icon-"],[class^=xnote-icon-]{speak:never;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:textbus!important;font-style:normal;font-variant:normal;font-weight:400;line-height:1;text-transform:none}.xnote-icon-timeline:before{content:"\e900"}.xnote-icon-step:before{content:"\e901"}.xnote-icon-arrow-left:before{content:"\e902"}.xnote-icon-arrow-right:before{content:"\e903"}.xnote-icon-arrow-top:before{content:"\e904"}.xnote-icon-arrow-bottom:before{content:"\e905"}.xnote-icon-source-code:before{content:"\e906"}.xnote-icon-insert-paragraph-after:before{content:"\e907"}.xnote-icon-insert-paragraph-before:before{content:"\e908"}.xnote-icon-plus:before{content:"\e909"}.xnote-icon-table-border:before{content:"\e90a"}.xnote-icon-table-remove:before{content:"\e90b"}.xnote-icon-function:before{content:"\e90c"}.xnote-icon-paint-bucket:before{content:"\e90d"}.xnote-icon-background-color:before{content:"\e90e"}.xnote-icon-color:before{content:"\e90f"}.xnote-icon-hightlight-box:before{content:"\e910"}.xnote-icon-table-edit:before{content:"\e911"}.xnote-icon-table-split-columns:before{content:"\e912"}.xnote-icon-align-middle:before{content:"\e913"}.xnote-icon-align-bottom:before{content:"\e914"}.xnote-icon-align-top:before{content:"\e915"}.xnote-icon-palette:before{content:"\e916"}.xnote-icon-split-cells:before{content:"\e917"}.xnote-icon-merge-cells:before{content:"\e918"}.xnote-icon-image:before{content:"\e919"}.xnote-icon-music:before{content:"\e91b"}.xnote-icon-video:before{content:"\e91c"}.xnote-icon-unlink:before{content:"\e91d"}.xnote-icon-select:before{content:"\e91e"}.xnote-icon-tree:before{content:"\e91f"}.xnote-icon-more:before{content:"\e921"}.xnote-icon-checkmark:before{content:"\e922"}.xnote-icon-text-wrap:before{content:"\e924"}.xnote-icon-heading-h1:before{content:"\e925"}.xnote-icon-heading-h2:before{content:"\e926"}.xnote-icon-heading-h3:before{content:"\e927"}.xnote-icon-heading-h4:before{content:"\e928"}.xnote-icon-heading-h5:before{content:"\e929"}.xnote-icon-heading-h6:before{content:"\e92a"}.xnote-icon-heading:before{content:"\e92b"}.xnote-icon-copy:before{content:"\e92c"}.xnote-icon-paste:before{content:"\e92d"}.xnote-icon-history-back:before{content:"\e967"}.xnote-icon-history-forward:before{content:"\e968"}.xnote-icon-quotes-right:before{content:"\e978"}.xnote-icon-bin:before{content:"\e9ac"}.xnote-icon-list-numbered:before{content:"\e9b9"}.xnote-icon-list:before{content:"\e9bb"}.xnote-icon-link:before{content:"\e9cb"}.xnote-icon-command:before{content:"\ea4e"}.xnote-icon-shift:before{content:"\ea4f"}.xnote-icon-ctrl:before{content:"\ea50"}.xnote-icon-opt:before{content:"\ea51"}.xnote-icon-checkbox-checked:before{content:"\ea52"}.xnote-icon-checkbox-unchecked:before{content:"\ea53"}.xnote-icon-cut:before{content:"\ea5a"}.xnote-icon-line-height:before{content:"\ea5f"}.xnote-icon-letter-spacing:before{content:"\ea60"}.xnote-icon-font-size:before{content:"\ea61"}.xnote-icon-bold:before{content:"\ea62"}.xnote-icon-underline:before{content:"\ea63"}.xnote-icon-italic:before{content:"\ea64"}.xnote-icon-strikethrough:before{content:"\ea65"}.xnote-icon-superscript:before{content:"\ea69"}.xnote-icon-subscript:before{content:"\ea6a"}.xnote-icon-table:before{content:"\ea71"}.xnote-icon-pilcrow:before{content:"\ea73"}.xnote-icon-ltr:before{content:"\ea74"}.xnote-icon-rtl:before{content:"\ea75"}.xnote-icon-paragraph-left:before{content:"\ea77"}.xnote-icon-paragraph-center:before{content:"\ea78"}.xnote-icon-paragraph-right:before{content:"\ea79"}.xnote-icon-paragraph-justify:before{content:"\ea7a"}.xnote-icon-indent-increase:before{content:"\ea7b"}.xnote-icon-indent-decrease:before{content:"\ea7c"}.xnote-icon-code:before{content:"\ea80"}.xnote-icon-clear-formatting:before{content:"\ea6f"}.xnote-h1{font-size:2.2em;font-weight:600}.xnote-h2{font-size:1.8em;font-weight:600}.xnote-h3{font-size:1.4em;font-weight:600}.xnote-h4{font-size:1em;font-weight:600}.xnote-h5{font-size:.9em;font-weight:600}.xnote-h6{font-size:.8em;font-weight:600}.xnote-code{border:1px solid rgba(0,0,0,.2);border-radius:4px;font-family:Microsoft YaHei Mono,Menlo,Monaco,Consolas,Courier New,monospace;margin:0 3px;padding:2px 3px}.xnote-timeline{display:block;padding-left:5px;padding-top:1em}.xnote-timeline-item{display:block;opacity:.76;padding-bottom:.5em;padding-left:1.5em;position:relative}.xnote-timeline-item:first-of-type>.xnote-timeline-line{top:1em}.xnote-timeline-item:last-of-type>.xnote-timeline-line{bottom:calc(100% - 1em)}.xnote-timeline-line{border-left:1px solid #dddee1;bottom:0;left:0;position:absolute;top:0;width:0}.xnote-timeline-icon{background-color:#fff;border:1px solid #bbbec4;border-radius:50%;box-sizing:border-box;height:9px;left:-4px;position:absolute;top:.5em;width:9px}.xnote-timeline-tools{display:none;position:absolute;right:0;top:0}.xnote-timeline-item-content>:first-child{margin-top:0}.xnote-timeline-item:hover .xnote-timeline-tools{display:block}.xnote-step{display:flex}.xnote-step-item{flex:1;position:relative}.xnote-step-item:last-child .xnote-step-item-line{display:none}.xnote-step-item.xnote-complete .xnote-step-item-line{border-top-color:#15bd9a}.xnote-step-item.xnote-complete .xnote-step-item-icon{background-color:#15bd9a}.xnote-step-item.xnote-current .xnote-step-item-line{border-top-style:dashed}.xnote-step-item.xnote-current .xnote-step-item-icon{background-color:#1296db}.xnote-step-item.xnote-waiting .xnote-step-item-line{border-top-style:dashed}.xnote-step-item.xnote-waiting .xnote-step-item-icon{background-color:#bbbec4}.xnote-step-item.xnote-waiting .xnote-step-item-content{opacity:.8}.xnote-step-item-header{cursor:pointer;margin-bottom:1em;position:relative}.xnote-step-item-icon{border-radius:50%;color:#fff;font-weight:500;height:1.6em;line-height:1.6em;position:relative;text-align:center;user-select:none;width:1.6em}.xnote-step-item-line{border-top:1px solid #dddee1;left:0;position:absolute;right:0;top:50%}.xnote-step-item-content{padding-right:15px}.xnote-step-title{font-size:1.2em;font-weight:500;margin:0}.xnote-step-title>small{font-weight:400;opacity:.8}.xnote-step-content{font-weight:400;margin:0}.xnote-step-tools{display:none;position:absolute;right:0;top:0}.xnote-step-item-content>:first-child{margin-top:0}.xnote-step-item:hover .xnote-step-tools{display:block} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sourcemap for "/data/development/SZKM/WEB/node_modules/@tanbo/color/bundles/esm/public-api.js" points to missing source files Sourcemap for "/data/development/SZKM/WEB/node_modules/@tanbo/color/bundles/esm/color.js" points to missing source files Sourcemap for "/data/development/SZKM/WEB/node_modules/@tanbo/color/bundles/esm/tools.js" points to missing source files Sourcemap for "/data/development/SZKM/WEB/node_modules/@tanbo/color/bundles/esm/utils.js" points to missing source files

@textbus
Copy link
Owner

textbus commented Dec 19, 2024

在 vue 中创建编辑器,需要确保你的 DOM 节点已经渲染出来。别忘了 Vue 的 onMounted

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { Editor } from "@textbus/xnote";
import 'katex/dist/katex.css'
import '@textbus/xnote/bundles/index.css'

const editorRef = ref()
const editor = new Editor()
onMounted(() => {
  editor.mount(editorRef.value).then(() => {
    console.log('编辑器创建完成')
  })
})
</script>
<template>
  <div ref="editorRef" class="editor">

  </div>
</template>

<style>
* {
  box-sizing: border-box;
}
.editor {
  width: 400px;
  text-align: left;
  margin: 0 auto;
}
</style>

@FullStackPlayer
Copy link
Author

在 vue 中创建编辑器,需要确保你的 DOM 节点已经渲染出来。别忘了 Vue 的 onMounted

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { Editor } from "@textbus/xnote";
import 'katex/dist/katex.css'
import '@textbus/xnote/bundles/index.css'

const editorRef = ref()
const editor = new Editor()
onMounted(() => {
  editor.mount(editorRef.value).then(() => {
    console.log('编辑器创建完成')
  })
})
</script>
<template>
  <div ref="editorRef" class="editor">

  </div>
</template>

<style>
* {
  box-sizing: border-box;
}
.editor {
  width: 400px;
  text-align: left;
  margin: 0 auto;
}
</style>

已经按照你的代码修改过了,报错依然,我看提示是 highlight.js 的引入问题,但是因为 highlight.js 在我项目中不是直接依赖,而是你 xnote 的间接依赖,所以这个我不太好处理,暂时没有足够的时间去看你的源码,能麻烦你从这个方向排查一下吗?谢谢。

@textbus
Copy link
Owner

textbus commented Dec 19, 2024

在 vue 中创建编辑器,需要确保你的 DOM 节点已经渲染出来。别忘了 Vue 的 onMounted

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { Editor } from "@textbus/xnote";
import 'katex/dist/katex.css'
import '@textbus/xnote/bundles/index.css'

const editorRef = ref()
const editor = new Editor()
onMounted(() => {
  editor.mount(editorRef.value).then(() => {
    console.log('编辑器创建完成')
  })
})
</script>
<template>
  <div ref="editorRef" class="editor">

  </div>
</template>

<style>
* {
  box-sizing: border-box;
}
.editor {
  width: 400px;
  text-align: left;
  margin: 0 auto;
}
</style>

已经按照你的代码修改过了,报错依然,我看提示是 highlight.js 的引入问题,但是因为 highlight.js 在我项目中不是直接依赖,而是你 xnote 的间接依赖,所以这个我不太好处理,暂时没有足够的时间去看你的源码,能麻烦你从这个方向排查一下吗?谢谢。

你可以手动安装一下 highlight.js 试一下看看

@textbus
Copy link
Owner

textbus commented Dec 19, 2024

我用 vite 已经试过了,是不会报错的

@FullStackPlayer
Copy link
Author

在 vue 中创建编辑器,需要确保你的 DOM 节点已经渲染出来。别忘了 Vue 的 onMounted

<script setup lang="ts">
import { onMounted, ref } from "vue";
import { Editor } from "@textbus/xnote";
import 'katex/dist/katex.css'
import '@textbus/xnote/bundles/index.css'

const editorRef = ref()
const editor = new Editor()
onMounted(() => {
  editor.mount(editorRef.value).then(() => {
    console.log('编辑器创建完成')
  })
})
</script>
<template>
  <div ref="editorRef" class="editor">

  </div>
</template>

<style>
* {
  box-sizing: border-box;
}
.editor {
  width: 400px;
  text-align: left;
  margin: 0 auto;
}
</style>

已经按照你的代码修改过了,报错依然,我看提示是 highlight.js 的引入问题,但是因为 highlight.js 在我项目中不是直接依赖,而是你 xnote 的间接依赖,所以这个我不太好处理,暂时没有足够的时间去看你的源码,能麻烦你从这个方向排查一下吗?谢谢。

你可以手动安装一下 highlight.js 试一下看看

试过了,还是不行,这个有点莫名其妙了,回头我再查查看

@FullStackPlayer
Copy link
Author

我用 vite 已经试过了,是不会报错的

好的,谢谢

@FullStackPlayer
Copy link
Author

FullStackPlayer commented Dec 20, 2024

我用 vite 已经试过了,是不会报错的

刚反应过来,我的项目路由是动态创建的,报错的源头也是这里,不知道是不是这个原因,route 代码供参考,也许可以帮你复现报错:

const appViews = import.meta.glob('@/ui/views/**/*.vue');
const appViewKeys = Object.keys(appViews);
const routes: Array<RouteRecordRaw> = [];
for (let i = 0; i < appViewKeys.length; i++) {
    const pathName = appViewKeys[i];
    const keyName = pathName.replace('/src/ui/views/', '').replace('/index.vue', '');
    routes.push({
        name: `app.${keyName}`,
        path: `${keyName}`,
        component: () => appViews[pathName](),
        meta: {
            showLoading: false,
            requiresAuth: true
        },
    })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants