ueditor-plus-assets 0.1.0 → 0.1.2
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/README.md +3 -3
- package/dist/UEditorPlus/dialogs/ai/ai.html +139 -0
- package/dist/UEditorPlus/dialogs/ai/ai.js +282 -0
- package/dist/UEditorPlus/dialogs/anchor/anchor.html +62 -0
- package/dist/UEditorPlus/dialogs/attachment/attachment.css +716 -0
- package/dist/UEditorPlus/dialogs/attachment/attachment.html +61 -0
- package/dist/UEditorPlus/dialogs/attachment/attachment.js +797 -0
- package/dist/UEditorPlus/dialogs/attachment/images/alignicon.gif +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/alignicon.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/bg.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/file-icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/file-icons.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/icons.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/image.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/progress.png +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/success.gif +0 -0
- package/dist/UEditorPlus/dialogs/attachment/images/success.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/audio.css +818 -0
- package/dist/UEditorPlus/dialogs/audio/audio.html +83 -0
- package/dist/UEditorPlus/dialogs/audio/audio.js +805 -0
- package/dist/UEditorPlus/dialogs/audio/images/bg.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/center_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/file-icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/file-icons.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/icons.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/image.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/left_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/none_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/progress.png +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/right_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/success.gif +0 -0
- package/dist/UEditorPlus/dialogs/audio/images/success.png +0 -0
- package/dist/UEditorPlus/dialogs/background/background.css +193 -0
- package/dist/UEditorPlus/dialogs/background/background.html +59 -0
- package/dist/UEditorPlus/dialogs/background/background.js +370 -0
- package/dist/UEditorPlus/dialogs/background/images/bg.png +0 -0
- package/dist/UEditorPlus/dialogs/background/images/success.png +0 -0
- package/dist/UEditorPlus/dialogs/contentimport/contentimport.html +177 -0
- package/dist/UEditorPlus/dialogs/contentimport/contentimport.js +91 -0
- package/dist/UEditorPlus/dialogs/contentimport/mammoth.browser.min.js +21 -0
- package/dist/UEditorPlus/dialogs/contentimport/showdown.min.js +3 -0
- package/dist/UEditorPlus/dialogs/emotion/emotion.css +129 -0
- package/dist/UEditorPlus/dialogs/emotion/emotion.html +70 -0
- package/dist/UEditorPlus/dialogs/emotion/emotion.js +186 -0
- package/dist/UEditorPlus/dialogs/emotion/images/0.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/bface.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/cface.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/fface.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/jxface2.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/tface.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/wface.gif +0 -0
- package/dist/UEditorPlus/dialogs/emotion/images/yface.gif +0 -0
- package/dist/UEditorPlus/dialogs/formula/formula.html +98 -0
- package/dist/UEditorPlus/dialogs/formula/formula.js +147 -0
- package/dist/UEditorPlus/dialogs/help/help.css +37 -0
- package/dist/UEditorPlus/dialogs/help/help.html +82 -0
- package/dist/UEditorPlus/dialogs/help/help.js +57 -0
- package/dist/UEditorPlus/dialogs/image/image.css +752 -0
- package/dist/UEditorPlus/dialogs/image/image.html +125 -0
- package/dist/UEditorPlus/dialogs/image/image.js +1051 -0
- package/dist/UEditorPlus/dialogs/image/images/alignicon.jpg +0 -0
- package/dist/UEditorPlus/dialogs/image/images/bg.png +0 -0
- package/dist/UEditorPlus/dialogs/image/images/icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/image/images/icons.png +0 -0
- package/dist/UEditorPlus/dialogs/image/images/image.png +0 -0
- package/dist/UEditorPlus/dialogs/image/images/progress.png +0 -0
- package/dist/UEditorPlus/dialogs/image/images/success.gif +0 -0
- package/dist/UEditorPlus/dialogs/image/images/success.png +0 -0
- package/dist/UEditorPlus/dialogs/insertframe/insertframe.html +135 -0
- package/dist/UEditorPlus/dialogs/internal.js +81 -0
- package/dist/UEditorPlus/dialogs/link/link.html +155 -0
- package/dist/UEditorPlus/dialogs/preview/preview.html +45 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/addimg.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/brush.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/delimg.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/delimgH.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/empty.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/emptyH.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/eraser.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/redo.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/redoH.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/scale.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/scaleH.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/size.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/undo.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/images/undoH.png +0 -0
- package/dist/UEditorPlus/dialogs/scrawl/scrawl.css +324 -0
- package/dist/UEditorPlus/dialogs/scrawl/scrawl.html +95 -0
- package/dist/UEditorPlus/dialogs/scrawl/scrawl.js +707 -0
- package/dist/UEditorPlus/dialogs/searchreplace/searchreplace.html +144 -0
- package/dist/UEditorPlus/dialogs/searchreplace/searchreplace.js +174 -0
- package/dist/UEditorPlus/dialogs/spechars/spechars.html +42 -0
- package/dist/UEditorPlus/dialogs/spechars/spechars.js +86 -0
- package/dist/UEditorPlus/dialogs/table/dragicon.png +0 -0
- package/dist/UEditorPlus/dialogs/table/edittable.css +85 -0
- package/dist/UEditorPlus/dialogs/table/edittable.html +69 -0
- package/dist/UEditorPlus/dialogs/table/edittable.js +241 -0
- package/dist/UEditorPlus/dialogs/table/edittd.html +62 -0
- package/dist/UEditorPlus/dialogs/table/edittip.html +33 -0
- package/dist/UEditorPlus/dialogs/template/config.js +42 -0
- package/dist/UEditorPlus/dialogs/template/images/bg.gif +0 -0
- package/dist/UEditorPlus/dialogs/template/images/pre0.png +0 -0
- package/dist/UEditorPlus/dialogs/template/images/pre1.png +0 -0
- package/dist/UEditorPlus/dialogs/template/images/pre2.png +0 -0
- package/dist/UEditorPlus/dialogs/template/images/pre3.png +0 -0
- package/dist/UEditorPlus/dialogs/template/images/pre4.png +0 -0
- package/dist/UEditorPlus/dialogs/template/template.css +99 -0
- package/dist/UEditorPlus/dialogs/template/template.html +26 -0
- package/dist/UEditorPlus/dialogs/template/template.js +53 -0
- package/dist/UEditorPlus/dialogs/video/images/bg.png +0 -0
- package/dist/UEditorPlus/dialogs/video/images/center_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/video/images/file-icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/video/images/file-icons.png +0 -0
- package/dist/UEditorPlus/dialogs/video/images/icons.gif +0 -0
- package/dist/UEditorPlus/dialogs/video/images/icons.png +0 -0
- package/dist/UEditorPlus/dialogs/video/images/image.png +0 -0
- package/dist/UEditorPlus/dialogs/video/images/left_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/video/images/none_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/video/images/progress.png +0 -0
- package/dist/UEditorPlus/dialogs/video/images/right_focus.jpg +0 -0
- package/dist/UEditorPlus/dialogs/video/images/success.gif +0 -0
- package/dist/UEditorPlus/dialogs/video/images/success.png +0 -0
- package/dist/UEditorPlus/dialogs/video/video.css +818 -0
- package/dist/UEditorPlus/dialogs/video/video.html +109 -0
- package/dist/UEditorPlus/dialogs/video/video.js +910 -0
- package/dist/UEditorPlus/dialogs/wordimage/wordimage.html +222 -0
- package/dist/UEditorPlus/dialogs/wordimage/wordimage.js +93 -0
- package/dist/UEditorPlus/index.html +168 -0
- package/dist/UEditorPlus/lang/en/en.js +788 -0
- package/dist/UEditorPlus/lang/en/images/addimage.png +0 -0
- package/dist/UEditorPlus/lang/en/images/alldeletebtnhoverskin.png +0 -0
- package/dist/UEditorPlus/lang/en/images/alldeletebtnupskin.png +0 -0
- package/dist/UEditorPlus/lang/en/images/background.png +0 -0
- package/dist/UEditorPlus/lang/en/images/button.png +0 -0
- package/dist/UEditorPlus/lang/en/images/copy.png +0 -0
- package/dist/UEditorPlus/lang/en/images/deletedisable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/deleteenable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/listbackground.png +0 -0
- package/dist/UEditorPlus/lang/en/images/localimage.png +0 -0
- package/dist/UEditorPlus/lang/en/images/music.png +0 -0
- package/dist/UEditorPlus/lang/en/images/rotateleftdisable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/rotateleftenable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/rotaterightdisable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/rotaterightenable.png +0 -0
- package/dist/UEditorPlus/lang/en/images/upload.png +0 -0
- package/dist/UEditorPlus/lang/zh-cn/images/copy.png +0 -0
- package/dist/UEditorPlus/lang/zh-cn/images/localimage.png +0 -0
- package/dist/UEditorPlus/lang/zh-cn/images/music.png +0 -0
- package/dist/UEditorPlus/lang/zh-cn/images/upload.png +0 -0
- package/dist/UEditorPlus/lang/zh-cn/zh-cn.js +812 -0
- package/dist/UEditorPlus/plugins/demo/demo.js +3 -0
- package/dist/UEditorPlus/themes/default/css/ueditor.css +2170 -0
- package/dist/UEditorPlus/themes/default/dialog.css +642 -0
- package/dist/UEditorPlus/themes/default/dialogbase.css +100 -0
- package/dist/UEditorPlus/themes/default/exts/ai.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/apk.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/chm.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/css.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/doc.svg +22 -0
- package/dist/UEditorPlus/themes/default/exts/docx.svg +22 -0
- package/dist/UEditorPlus/themes/default/exts/dwg.svg +16 -0
- package/dist/UEditorPlus/themes/default/exts/folder.svg +3 -0
- package/dist/UEditorPlus/themes/default/exts/gif.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/html.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/jpeg.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/jpg.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/log.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/mp3.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/mp4.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/pdf.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/png.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/ppt.svg +24 -0
- package/dist/UEditorPlus/themes/default/exts/pptx.svg +24 -0
- package/dist/UEditorPlus/themes/default/exts/psd.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/rar.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/svg.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/torrent.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/txt.svg +14 -0
- package/dist/UEditorPlus/themes/default/exts/unknown.svg +12 -0
- package/dist/UEditorPlus/themes/default/exts/xls.svg +25 -0
- package/dist/UEditorPlus/themes/default/exts/xlsx.svg +25 -0
- package/dist/UEditorPlus/themes/default/exts/zip.svg +12 -0
- package/dist/UEditorPlus/themes/default/images/anchor.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/arrow.png +0 -0
- package/dist/UEditorPlus/themes/default/images/arrow_down.png +0 -0
- package/dist/UEditorPlus/themes/default/images/arrow_up.png +0 -0
- package/dist/UEditorPlus/themes/default/images/button-bg.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/cancelbutton.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/charts.png +0 -0
- package/dist/UEditorPlus/themes/default/images/cursor_h.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/cursor_h.png +0 -0
- package/dist/UEditorPlus/themes/default/images/cursor_v.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/cursor_v.png +0 -0
- package/dist/UEditorPlus/themes/default/images/dialog-title-bg.png +0 -0
- package/dist/UEditorPlus/themes/default/images/filescan.png +0 -0
- package/dist/UEditorPlus/themes/default/images/highlighted.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/icons-all.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/icons.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/icons.png +0 -0
- package/dist/UEditorPlus/themes/default/images/img-cracked.png +0 -0
- package/dist/UEditorPlus/themes/default/images/loaderror.png +0 -0
- package/dist/UEditorPlus/themes/default/images/loading.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/lock.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/neweditor-tab-bg.png +0 -0
- package/dist/UEditorPlus/themes/default/images/pagebreak.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/scale.png +0 -0
- package/dist/UEditorPlus/themes/default/images/sortable.png +0 -0
- package/dist/UEditorPlus/themes/default/images/spacer.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/sparator_v.png +0 -0
- package/dist/UEditorPlus/themes/default/images/table-cell-align.png +0 -0
- package/dist/UEditorPlus/themes/default/images/tangram-colorpicker.png +0 -0
- package/dist/UEditorPlus/themes/default/images/toolbar_bg.png +0 -0
- package/dist/UEditorPlus/themes/default/images/unhighlighted.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/upload.png +0 -0
- package/dist/UEditorPlus/themes/default/images/videologo.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/word.gif +0 -0
- package/dist/UEditorPlus/themes/default/images/wordpaste.png +0 -0
- package/dist/UEditorPlus/themes/iframe.css +63 -0
- package/dist/UEditorPlus/third-party/SyntaxHighlighter/shCore.js +3655 -0
- package/dist/UEditorPlus/third-party/SyntaxHighlighter/shCoreDefault.css +1 -0
- package/dist/UEditorPlus/third-party/clipboard/clipboard.js +753 -0
- package/dist/UEditorPlus/third-party/clipboard/clipboard.swf +0 -0
- package/dist/UEditorPlus/third-party/codemirror/codemirror.css +106 -0
- package/dist/UEditorPlus/third-party/codemirror/codemirror.js +3581 -0
- package/dist/UEditorPlus/third-party/jquery-1.10.2.js +6 -0
- package/dist/UEditorPlus/third-party/showdown.js +2 -0
- package/dist/UEditorPlus/third-party/vue.js +1 -0
- package/dist/UEditorPlus/third-party/webuploader/webuploader.css +88 -0
- package/dist/UEditorPlus/third-party/webuploader/webuploader.js +10178 -0
- package/dist/UEditorPlus/third-party/zeroclipboard/ZeroClipboard.js +1256 -0
- package/dist/UEditorPlus/third-party/zeroclipboard/ZeroClipboard.swf +0 -0
- package/dist/UEditorPlus/ueditor.all.js +36896 -0
- package/dist/UEditorPlus/ueditor.config.js +761 -0
- package/dist/UEditorPlus/ueditor.parse.js +907 -0
- package/index.js +5 -5
- package/package.json +29 -29
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# ueditor-plus-assets
|
|
2
|
-
|
|
3
|
-
Static assets for UEditorPlus.
|
|
1
|
+
# ueditor-plus-assets
|
|
2
|
+
|
|
3
|
+
Static assets for UEditorPlus.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title></title>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
6
|
+
<link rel="stylesheet" href="./../../themes/default/dialog.css?{timestamp}">
|
|
7
|
+
<script type="text/javascript" src="../internal.js?{timestamp}"></script>
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
[v-cloak] {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.wrapper {
|
|
14
|
+
width: 620px;
|
|
15
|
+
padding: 10px;
|
|
16
|
+
height: 399px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
position: relative;
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
}
|
|
22
|
+
.wrapper .input::placeholder{
|
|
23
|
+
color:#999;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ai-operate {
|
|
27
|
+
display: block;
|
|
28
|
+
min-width: 8em;
|
|
29
|
+
text-align: center;
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
line-height: 30px;
|
|
32
|
+
background: var(--edui-color-border);
|
|
33
|
+
color: #111;
|
|
34
|
+
border-radius: 15px;
|
|
35
|
+
padding: 0 10px;
|
|
36
|
+
margin: 5px 5px 0 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ai-operate:hover {
|
|
40
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, .1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.btn.primary:hover {
|
|
44
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, .2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.close:hover {
|
|
48
|
+
color: red !important;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
51
|
+
</head>
|
|
52
|
+
<body>
|
|
53
|
+
<div class="wrapper" id="app" v-cloak>
|
|
54
|
+
|
|
55
|
+
<div>
|
|
56
|
+
<div v-if="selectText"
|
|
57
|
+
style="line-height:30px;padding:0 10px;border-radius:5px;margin-bottom:10px;display:inline-flex;align-items:center;">
|
|
58
|
+
<div style="margin-right:5px;">
|
|
59
|
+
<i class="edui-iconfont edui-icon-outline" style="font-size:18px;"></i>
|
|
60
|
+
</div>
|
|
61
|
+
<div style="text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:550px;">
|
|
62
|
+
{{ selectText }}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="flex" style="padding: 5px; border-radius: 30px; box-shadow: 0 0 10px #CCC;">
|
|
66
|
+
<div class="flex-grow">
|
|
67
|
+
<input type="text" v-model="inputText"
|
|
68
|
+
class="input"
|
|
69
|
+
style="width:540px;border-color:transparent;font-size:14px;"
|
|
70
|
+
placeholder=""
|
|
71
|
+
id="lang_input_placeholder"/>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="flex-shrink-0" style="width:32px;padding-right:5px;">
|
|
74
|
+
<a href="javascript:;" class="btn primary"
|
|
75
|
+
@click="doSubmit"
|
|
76
|
+
style="width:30px;text-align:center;padding:0;border-radius:50%;">
|
|
77
|
+
<i v-if="loading" class="edui-iconfont edui-icon-refresh"
|
|
78
|
+
style="display:inline-block;animation:spin 2s linear infinite;"></i>
|
|
79
|
+
<i v-else class="edui-iconfont edui-icon-right-direction"></i>
|
|
80
|
+
</a>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div v-if="resultHtml || resultError"
|
|
84
|
+
style="border-top:1px solid #F2F2F2;margin-top:10px;padding-top:10px;">
|
|
85
|
+
<div v-if="resultError"
|
|
86
|
+
style="color:red;background:rgba(255,0,0,0.1);margin-bottom:10px;padding:10px;border-radius:10px;">
|
|
87
|
+
{{ resultError }}
|
|
88
|
+
</div>
|
|
89
|
+
<div class="flex flex-items-center" style="height:30px;">
|
|
90
|
+
<div class="flex-grow">
|
|
91
|
+
<i class="edui-iconfont edui-icon-robot" style="font-size:16px;"></i>
|
|
92
|
+
<var id="lang_result_title"></var>
|
|
93
|
+
</div>
|
|
94
|
+
<div>
|
|
95
|
+
<a v-if="!loading" @click="doInsert" href="javascript:;" class="btn sm">
|
|
96
|
+
<i class="edui-iconfont edui-icon-page-break"></i>
|
|
97
|
+
<var id="lang_insert"></var>
|
|
98
|
+
</a>
|
|
99
|
+
<a v-if="!loading&&selectText" @click="doReplace" href="javascript:;" class="btn sm">
|
|
100
|
+
<i class="edui-iconfont edui-icon-eraser"></i>
|
|
101
|
+
<var id="lang_replace"></var>
|
|
102
|
+
</a>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div
|
|
106
|
+
style="margin-top:10px;background:rgba(0,0,0,0.03);padding:10px;border-radius:10px;overflow:auto;"
|
|
107
|
+
:style="{height:resultHeight}"
|
|
108
|
+
>
|
|
109
|
+
<div class="ub-html" v-html="resultHtml"></div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div v-else
|
|
113
|
+
style="border-top:1px solid #F2F2F2;margin-top:10px;padding-top:10px;">
|
|
114
|
+
<div v-if="functions.length" style="color:#999;">
|
|
115
|
+
<i class="edui-iconfont edui-icon-bell" style="font-size:16px;"></i>
|
|
116
|
+
<var id="lang_tip_with_actions"></var>
|
|
117
|
+
</div>
|
|
118
|
+
<div v-else style="color:#999;">
|
|
119
|
+
<i class="edui-iconfont edui-icon-bell" style="font-size:16px;"></i>
|
|
120
|
+
<var id="lang_tip_without_actions"></var>
|
|
121
|
+
</div>
|
|
122
|
+
<div style="padding-top:10px;display:flex;">
|
|
123
|
+
<a href="javascript:;" v-for="f in functions"
|
|
124
|
+
@click="doSubmitFunction(f)"
|
|
125
|
+
class="ai-operate">
|
|
126
|
+
<span v-html="f.text"></span>
|
|
127
|
+
</a>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
</div>
|
|
133
|
+
<script src="../../third-party/vue.js?{timestamp}"></script>
|
|
134
|
+
<script src="../../third-party/showdown.js?{timestamp}"></script>
|
|
135
|
+
<script src="../../third-party/jquery-1.10.2.js?{timestamp}"></script>
|
|
136
|
+
<script type="text/javascript" src="../../third-party/clipboard/clipboard.js?{timestamp}"></script>
|
|
137
|
+
<script type="text/javascript" src="./ai.js?{timestamp}"></script>
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
var aiConfig = editor.getOpt('ai')
|
|
2
|
+
|
|
3
|
+
var aiFunctions = editor.getOpt('aiFunctions');
|
|
4
|
+
|
|
5
|
+
var isMultiLine = function (text) {
|
|
6
|
+
return text.indexOf('\n') !== -1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
var fetchStream = function (url, option, onStream, onFinish) {
|
|
10
|
+
fetch(url, Object.assign({
|
|
11
|
+
method: 'POST',
|
|
12
|
+
}, option)).then(function (response) {
|
|
13
|
+
if (!response.ok) {
|
|
14
|
+
onFinish({code: -1, msg: 'HTTP error! status: ' + response.status})
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
var reader = response.body.getReader();
|
|
18
|
+
var decoder = new TextDecoder('utf-8');
|
|
19
|
+
var buffer = '';
|
|
20
|
+
var textList = [];
|
|
21
|
+
|
|
22
|
+
function processChunk(chunk) {
|
|
23
|
+
buffer += decoder.decode(chunk, {stream: true});
|
|
24
|
+
// 分割事件流,每个事件以"data:"开头,以两个换行符结束
|
|
25
|
+
var lines = buffer.split('\n');
|
|
26
|
+
for (var i = 0; i < lines.length; i++) {
|
|
27
|
+
var line = lines[i];
|
|
28
|
+
line = line.trim();
|
|
29
|
+
if (line.startsWith('data:')) {
|
|
30
|
+
var jsonStr = line.replace('data:', '').trim();
|
|
31
|
+
if (jsonStr === '[DONE]') {
|
|
32
|
+
onFinish({code: 0, msg: 'ok', data: {text: textList.join('')}})
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
var text = null;
|
|
37
|
+
var data = JSON.parse(jsonStr);
|
|
38
|
+
if (data.choices && data.choices.length > 0 && data.choices[0].delta) {
|
|
39
|
+
text = data.choices[0].delta.content;
|
|
40
|
+
} else if (data.type) {
|
|
41
|
+
// 兼容ModStart
|
|
42
|
+
// {"type":"error","data":"xxx"}
|
|
43
|
+
// {"type":"end","data":"xxx"}
|
|
44
|
+
// {"type":"data","data":"xxx"}
|
|
45
|
+
if (data.type === 'error') {
|
|
46
|
+
onFinish({code: -1, msg: data.data});
|
|
47
|
+
return;
|
|
48
|
+
} else if (data.type === 'end') {
|
|
49
|
+
onFinish({code: 0, msg: 'ok', data: {text: textList.join('')}});
|
|
50
|
+
return;
|
|
51
|
+
} else if (data.type === 'data') {
|
|
52
|
+
text = data.data;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (text !== null) {
|
|
56
|
+
textList.push(text);
|
|
57
|
+
onStream({code: 0, msg: 'ok', data: {text: text}});
|
|
58
|
+
} else {
|
|
59
|
+
onFinish({code: -1, msg: 'No text found!'});
|
|
60
|
+
console.log('data:', data);
|
|
61
|
+
}
|
|
62
|
+
} catch (e) {
|
|
63
|
+
onFinish({code: -1, msg: 'JSON parse error!' + e});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
buffer = lines.pop() || '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function read() {
|
|
71
|
+
reader.read().then(function (result) {
|
|
72
|
+
var done = result.done;
|
|
73
|
+
var value = result.value;
|
|
74
|
+
if (done) {
|
|
75
|
+
if (buffer) processChunk(new Uint8Array());
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
processChunk(value);
|
|
79
|
+
read();
|
|
80
|
+
}).catch(function (error) {
|
|
81
|
+
onFinish({code: -1, msg: 'Stream error!' + error});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
read();
|
|
86
|
+
}).catch(function (error) {
|
|
87
|
+
onFinish({code: -1, msg: 'Request error!' + error});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var openAiCompletion = function (url, param, option) {
|
|
92
|
+
option = Object.assign({
|
|
93
|
+
body: null
|
|
94
|
+
}, option)
|
|
95
|
+
if (!option.body) {
|
|
96
|
+
option.body = {
|
|
97
|
+
model: aiConfig.driverConfig.model,
|
|
98
|
+
messages: [{role: 'user', content: param.promptText}],
|
|
99
|
+
stream: true,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
fetchStream(
|
|
103
|
+
url,
|
|
104
|
+
{
|
|
105
|
+
headers: {
|
|
106
|
+
'Authorization': 'Bearer ' + aiConfig.driverConfig.key,
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
},
|
|
109
|
+
body: JSON.stringify(option.body)
|
|
110
|
+
},
|
|
111
|
+
param.onStream,
|
|
112
|
+
param.onFinish
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var drivers = {
|
|
117
|
+
'ModStart': function (param) {
|
|
118
|
+
openAiCompletion(aiConfig.driverConfig.url, param, {
|
|
119
|
+
body: {
|
|
120
|
+
prompt: param.promptText
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
},
|
|
124
|
+
'OpenAi': function (param) {
|
|
125
|
+
openAiCompletion(aiConfig.driverConfig.url || 'https://api.openai.com/v1/engines/davinci/completions', param)
|
|
126
|
+
},
|
|
127
|
+
'DeepSeek': function (param) {
|
|
128
|
+
openAiCompletion(aiConfig.driverConfig.url || 'https://api.deepseek.com/chat/completions', param)
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function getRequest(driver) {
|
|
133
|
+
if (aiConfig.driverRequest) {
|
|
134
|
+
return aiConfig.driverRequest
|
|
135
|
+
}
|
|
136
|
+
if (driver in drivers) {
|
|
137
|
+
return drivers[driver]
|
|
138
|
+
}
|
|
139
|
+
return null
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var converter = new window.showdown.Converter();
|
|
143
|
+
|
|
144
|
+
var Ai = {
|
|
145
|
+
runtime: {
|
|
146
|
+
range: null,
|
|
147
|
+
},
|
|
148
|
+
init: function () {
|
|
149
|
+
new Vue({
|
|
150
|
+
el: '#app',
|
|
151
|
+
data: {
|
|
152
|
+
loading: false,
|
|
153
|
+
selectText: '',
|
|
154
|
+
inputText: '',
|
|
155
|
+
promptText: '',
|
|
156
|
+
resultText: '',
|
|
157
|
+
resultError: '',
|
|
158
|
+
functions: [],
|
|
159
|
+
},
|
|
160
|
+
mounted: function () {
|
|
161
|
+
Ai.runtime.range = editor.selection.getRange();
|
|
162
|
+
var cloneContents = Ai.runtime.range.cloneContents();
|
|
163
|
+
if (cloneContents) {
|
|
164
|
+
this.selectText = cloneContents.textContent.trim();
|
|
165
|
+
} else {
|
|
166
|
+
this.selectText = '';
|
|
167
|
+
}
|
|
168
|
+
this.buildFunctions()
|
|
169
|
+
},
|
|
170
|
+
computed: {
|
|
171
|
+
resultHtml: function () {
|
|
172
|
+
if (!this.resultText) {
|
|
173
|
+
return '';
|
|
174
|
+
}
|
|
175
|
+
return converter.makeHtml(this.resultText);
|
|
176
|
+
},
|
|
177
|
+
resultHeight: function () {
|
|
178
|
+
var height = 255;
|
|
179
|
+
if (this.selectText) {
|
|
180
|
+
height -= 45;
|
|
181
|
+
}
|
|
182
|
+
if (this.resultError) {
|
|
183
|
+
height -= 45;
|
|
184
|
+
}
|
|
185
|
+
return height + 'px';
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
methods: {
|
|
189
|
+
buildFunctions: function () {
|
|
190
|
+
var enableParam = {
|
|
191
|
+
selectText: this.selectText
|
|
192
|
+
}
|
|
193
|
+
this.functions = aiFunctions.map(function (f) {
|
|
194
|
+
if (!f.enable(enableParam)) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
f.prompt = f.prompt.replace(/\{selectText\}/g, enableParam.selectText);
|
|
198
|
+
return f;
|
|
199
|
+
}).filter(function (f) {
|
|
200
|
+
return !!f;
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
doSubmit: function () {
|
|
204
|
+
if (this.loading) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (this.inputText) {
|
|
208
|
+
if (this.selectText) {
|
|
209
|
+
this.promptText = this.selectText + '\n\n' + this.inputText;
|
|
210
|
+
} else {
|
|
211
|
+
this.promptText = this.inputText;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (!this.promptText) {
|
|
215
|
+
editor.tipError(editor.getLang("ai.emptyPrompt"));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.loading = true;
|
|
219
|
+
this.resultError = '';
|
|
220
|
+
this.resultText = '';
|
|
221
|
+
var driverRequest = getRequest(aiConfig.driver)
|
|
222
|
+
if (!driverRequest) {
|
|
223
|
+
editor.tipError(editor.getLang("ai.driverMissing"));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
driverRequest({
|
|
227
|
+
promptText: this.promptText,
|
|
228
|
+
onStream: function (res) {
|
|
229
|
+
if (res.code) {
|
|
230
|
+
this.resultError = res.msg;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
this.resultText += res.data.text;
|
|
234
|
+
}.bind(this),
|
|
235
|
+
onFinish: function (res) {
|
|
236
|
+
this.loading = false;
|
|
237
|
+
if (res.code) {
|
|
238
|
+
this.resultError = res.msg;
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
this.resultText = res.data.text;
|
|
242
|
+
}.bind(this)
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
doSubmitFunction: function (f) {
|
|
246
|
+
this.promptText = f.prompt;
|
|
247
|
+
this.doSubmit()
|
|
248
|
+
},
|
|
249
|
+
doInsert: function () {
|
|
250
|
+
editor.fireEvent('saveScene');
|
|
251
|
+
if (this.selectText) {
|
|
252
|
+
if (isMultiLine(this.resultText)) {
|
|
253
|
+
Ai.runtime.range.insertNode(document.createRange().createContextualFragment(this.resultHtml));
|
|
254
|
+
} else {
|
|
255
|
+
Ai.runtime.range.insertNode(document.createTextNode(this.resultText));
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
if (isMultiLine(this.resultText)) {
|
|
259
|
+
editor.execCommand('insertHtml', this.resultHtml);
|
|
260
|
+
} else {
|
|
261
|
+
editor.execCommand('insertHtml', this.resultText);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
dialog.close(true);
|
|
265
|
+
},
|
|
266
|
+
doReplace: function () {
|
|
267
|
+
editor.fireEvent('saveScene');
|
|
268
|
+
Ai.runtime.range.deleteContents();
|
|
269
|
+
if (isMultiLine(this.resultText)) {
|
|
270
|
+
Ai.runtime.range.insertNode(document.createRange().createContextualFragment(this.resultHtml));
|
|
271
|
+
} else {
|
|
272
|
+
Ai.runtime.range.insertNode(document.createTextNode(this.resultText));
|
|
273
|
+
}
|
|
274
|
+
dialog.close(true);
|
|
275
|
+
},
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
utils.domReady(function () {
|
|
281
|
+
Ai.init();
|
|
282
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
6
|
+
<title></title>
|
|
7
|
+
<style type="text/css">
|
|
8
|
+
* {
|
|
9
|
+
color: #838383;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
html, body {
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content {
|
|
20
|
+
padding: 5px 0 0 15px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input {
|
|
24
|
+
margin-left: 4px;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
width: 210px;
|
|
27
|
+
height: 30px;
|
|
28
|
+
line-height: 30px;
|
|
29
|
+
border: 1px solid #F2F2F2;
|
|
30
|
+
border-radius: 3px;
|
|
31
|
+
padding: 0 5px;
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="content">
|
|
38
|
+
<span><var id="lang_input_anchorName"></var></span><input id="anchorName" value=""/>
|
|
39
|
+
</div>
|
|
40
|
+
<script type="text/javascript" src="../internal.js?{timestamp}"></script>
|
|
41
|
+
<script type="text/javascript">
|
|
42
|
+
var anchorInput = $G('anchorName'),
|
|
43
|
+
node = editor.selection.getRange().getClosedNode();
|
|
44
|
+
if (node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))) {
|
|
45
|
+
anchorInput.value = node;
|
|
46
|
+
}
|
|
47
|
+
anchorInput.onkeydown = function (evt) {
|
|
48
|
+
evt = evt || window.event;
|
|
49
|
+
if (evt.keyCode == 13) {
|
|
50
|
+
editor.execCommand('anchor', anchorInput.value);
|
|
51
|
+
dialog.close();
|
|
52
|
+
domUtils.preventDefault(evt)
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
dialog.onok = function () {
|
|
56
|
+
editor.execCommand('anchor', anchorInput.value);
|
|
57
|
+
dialog.close();
|
|
58
|
+
};
|
|
59
|
+
$focus(anchorInput);
|
|
60
|
+
</script>
|
|
61
|
+
</body>
|
|
62
|
+
</html>
|