@jx3box/jx3box-editor 1.1.4 → 1.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.
@@ -1,5 +1,4 @@
1
- // @import 'node_modules/csslab/base.less';
2
- // @import 'node_modules/@jx3box/jx3box-common/css/var.less';
1
+ // tinymce文章样式
3
2
 
4
3
  @import "tinymce/_.less";
5
4
  @import "tinymce/a.less";
@@ -23,6 +22,7 @@
23
22
  @import "tinymce/video.less";
24
23
  @import "tinymce/macro.less";
25
24
  @import "tinymce/qixue.less";
25
+ @import "tinymce/pz.less";
26
26
 
27
27
  @import "module/directory.less";
28
28
  @import "module/icon.less";
@@ -1,3 +1,5 @@
1
+ // md文章样式
2
+
1
3
  @import "module/macro.less";
2
4
  @import "module/talent.less";
3
5
 
@@ -1,3 +1,4 @@
1
+ // md编辑器样式
1
2
  .c-editor-markdown {
2
3
  .c-editor-header {
3
4
  .mb(10px);
@@ -22,7 +22,7 @@
22
22
  display: none;
23
23
  }
24
24
  @media print{
25
- .c-article{
25
+ .c-article-tinymce{
26
26
  -webkit-print-color-adjust: exact;
27
27
  }
28
28
  }
@@ -1,5 +1,5 @@
1
1
  /* 链接 */
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce{
3
3
  a {
4
4
  color: #0366d6;
5
5
  text-decoration: none;
@@ -1,4 +1,4 @@
1
- .c-article-tinymce .c-article {
1
+ .c-article-tinymce{
2
2
  //兼容旧代码
3
3
  code {
4
4
  font-family: Consolas, monospace, serif;
@@ -1,5 +1,5 @@
1
1
  // 折叠文本
2
- .c-article-tinymce .c-article {
2
+ .c-article-tinymce{
3
3
  .e-details,
4
4
  .e-summary {
5
5
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica,
@@ -1,5 +1,5 @@
1
1
  //标题
2
- .c-article-tinymce .c-article {
2
+ .c-article-tinymce {
3
3
  h1,
4
4
  h2,
5
5
  h3,
@@ -1,5 +1,5 @@
1
1
  /* 水平线 */
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce{
3
3
  hr {
4
4
  margin-top: 22px;
5
5
  margin-bottom: 22px;
@@ -1,5 +1,5 @@
1
1
  //图片
2
- .c-article-tinymce .c-article {
2
+ .c-article-tinymce {
3
3
  img {
4
4
  height: auto;
5
5
  padding: 5px;
@@ -1,5 +1,5 @@
1
1
  // 编辑器内样式
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce{
3
3
  .w-latex{
4
4
  .pr;
5
5
  font-family: Georgia, 'Times New Roman', Times, serif;
@@ -37,6 +37,7 @@
37
37
  // 新版checklist
38
38
  .tox-checklist > li{
39
39
  line-height: 2.2;
40
+ margin:0 !important;
40
41
  }
41
42
  .tox-checklist > li:not(.tox-checklist--hidden) {
42
43
  list-style: none;
@@ -1,5 +1,5 @@
1
1
  // 编辑器外样式
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce{
3
3
  .e-jx3macro-area{
4
4
  .pr;
5
5
  &:after{
@@ -0,0 +1,39 @@
1
+ // 编辑器内
2
+ .e-pz-iframe{
3
+ min-height: 24px;
4
+ border-radius: 4px;
5
+ font-size: 14px;
6
+ width: 100%;
7
+ box-sizing: border-box;
8
+ background-color: #f1f8ff;
9
+ border: 1px solid #c8e1ff;
10
+ color: darken(#c8e1ff, 20%);
11
+
12
+ line-height: 40px !important;
13
+ padding: 0 10px 0 140px;
14
+ font-family: Monaco, Consolas, "Lucida Console", "Courier New", serif;
15
+
16
+ .pr;
17
+ &:after {
18
+ content: "JX3BOX·配装方案";
19
+ position: absolute;
20
+ .lt(8px);
21
+ background-color: darken(#c8e1ff, 20%);
22
+ color: #fff;
23
+ border-radius: 3px;
24
+ padding: 2px 8px;
25
+ line-height: 21px;
26
+ }
27
+ }
28
+ // 渲染模式隐藏
29
+ .c-article-tinymce{
30
+ .e-pz-iframe{
31
+ display: none;
32
+ }
33
+ }
34
+ // tinymce编辑器内展示
35
+ .c-article-editor{
36
+ .e-pz-iframe{
37
+ display: block;
38
+ }
39
+ }
@@ -1,5 +1,5 @@
1
1
  /* 引用 */
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce{
3
3
  blockquote {
4
4
  border: 1px dashed #e1e4e8;
5
5
  border-radius: 4px;
@@ -1,5 +1,5 @@
1
1
  /* 表格 */
2
- .c-article-tinymce .c-article{
2
+ .c-article-tinymce {
3
3
  table {
4
4
  border-collapse: collapse;
5
5
  width: 100%;
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  @media screen and (max-width: @phone) {
42
- .c-article-tinymce .c-article{
42
+ .c-article-tinymce{
43
43
  table {
44
44
  display: block;
45
45
  width: 100% !important;
@@ -1,4 +1,4 @@
1
- .c-article-tinymce .c-article {
1
+ .c-article-tinymce {
2
2
  video {
3
3
  background-color: #333;
4
4
  width: 100%;
@@ -7,8 +7,9 @@
7
7
  cursor: pointer;
8
8
  }
9
9
  }
10
- .c-article-videox{
11
- iframe,iframe[allowfullscreen='allowfullscreen']{
10
+ .c-article-videox {
11
+ iframe,
12
+ iframe[allowfullscreen="allowfullscreen"] {
12
13
  width: 100%;
13
14
  height: 800px;
14
15
  border: 1px solid #eee;
@@ -16,17 +17,19 @@
16
17
  }
17
18
  }
18
19
  .c-article-editor {
19
- video,iframe {
20
+ video,
21
+ iframe {
20
22
  cursor: default;
21
23
  }
22
- iframe{
23
- width:auto;
24
- height:auto;
24
+ iframe {
25
+ width: auto;
26
+ height: auto;
25
27
  }
26
28
  }
27
- @media screen and (max-width:@ipad){
28
- .c-article video,.c-article-videox iframe{
29
- height:auto;
30
- min-height:200px;
29
+ @media screen and (max-width: @ipad) {
30
+ .c-article video,
31
+ .c-article-videox iframe {
32
+ height: auto;
33
+ min-height: 200px;
31
34
  }
32
- }
35
+ }
@@ -1,3 +1,4 @@
1
+ // tinymce编辑器样式
1
2
  .c-editor-header{
2
3
  .mb(10px);
3
4
  .clearfix;
@@ -56,4 +57,4 @@
56
57
  .none;
57
58
  }
58
59
  }
59
- }
60
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * highlight.js 默认支持(不需要额外装库)的语法
3
+ * https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
4
+ */
5
+
6
+ export default [
7
+ // 不加参数时默认的
8
+ { text: "JSON", value: "json" },
9
+ { text: "Lua", value: "lua" },
10
+ { text: "HTML, XML", value: "xml" },
11
+ { text: "Bash", value: "bash" },
12
+ { text: "JavaScript", value: "javascript" },
13
+ { text: "Python", value: "python" },
14
+ { text: "Java", value: "java" },
15
+ { text: "C", value: "c" },
16
+ { text: "C#", value: "csharp" },
17
+ { text: "C++", value: "cpp" },
18
+
19
+ // 其他支持的
20
+ { text: "1C", value: "1c" },
21
+ { text: "ABNF", value: "abnf" },
22
+ { text: "Access logs", value: "accesslog" },
23
+ { text: "Ada", value: "ada" },
24
+ { text: "Arduino (C++ w/Arduino libs)", value: "arduino" },
25
+ { text: "ARM assembler", value: "armasm" },
26
+ { text: "AVR assembler", value: "avrasm" },
27
+ { text: "ActionScript", value: "actionscript" },
28
+ { text: "AngelScript", value: "angelscript" },
29
+ { text: "Apache", value: "apache" },
30
+ { text: "AppleScript", value: "applescript" },
31
+ { text: "Arcade", value: "arcade" },
32
+ { text: "AsciiDoc", value: "asciidoc" },
33
+ { text: "AspectJ", value: "aspectj" },
34
+ { text: "AutoHotkey", value: "autohotkey" },
35
+ { text: "AutoIt", value: "autoit" },
36
+ { text: "Awk", value: "awk" },
37
+ { text: "Basic", value: "basic" },
38
+ { text: "BNF", value: "bnf" },
39
+ { text: "Brainfuck", value: "brainfuck" },
40
+ { text: "C/AL", value: "cal" },
41
+ { text: "Cache Object Script", value: "cos" },
42
+ { text: "CMake", value: "cmake" },
43
+ { text: "Coq", value: "coq" },
44
+ { text: "CSP", value: "csp" },
45
+ { text: "CSS", value: "css" },
46
+ { text: "Cap’n Proto", value: "capnproto" },
47
+ { text: "Clojure", value: "clojure" },
48
+ { text: "CoffeeScript", value: "coffeescript" },
49
+ { text: "Crmsh", value: "crmsh" },
50
+ { text: "Crystal", value: "crystal" },
51
+ { text: "D", value: "d" },
52
+ { text: "Dart", value: "dart" },
53
+ { text: "Delphi", value: "dpr" },
54
+ { text: "Diff", value: "diff" },
55
+ { text: "Django", value: "django" },
56
+ { text: "DNS Zone file", value: "dns" },
57
+ { text: "Dockerfile", value: "dockerfile" },
58
+ { text: "DOS", value: "dos" },
59
+ { text: "dsconfig", value: "dsconfig" },
60
+ { text: "DTS (Device Tree)", value: "dts" },
61
+ { text: "Dust", value: "dust" },
62
+ { text: "EBNF", value: "ebnf" },
63
+ { text: "Elixir", value: "elixir" },
64
+ { text: "Elm", value: "elm" },
65
+ { text: "Erlang", value: "erlang" },
66
+ { text: "Excel", value: "excel" },
67
+ { text: "F#", value: "fsharp" },
68
+ { text: "FIX", value: "fix" },
69
+ { text: "Fortran", value: "fortran" },
70
+ { text: "G-Code", value: "gcode" },
71
+ { text: "Gams", value: "gams" },
72
+ { text: "GAUSS", value: "gauss" },
73
+ { text: "Gherkin", value: "gherkin" },
74
+ { text: "Go", value: "go" },
75
+ { text: "Golo", value: "golo" },
76
+ { text: "Gradle", value: "gradle" },
77
+ { text: "Groovy", value: "groovy" },
78
+ { text: "HTTP", value: "http" },
79
+ { text: "Haml", value: "haml" },
80
+ { text: "Handlebars", value: "handlebars" },
81
+ { text: "Haskell", value: "haskell" },
82
+ { text: "Haxe", value: "haxe" },
83
+ { text: "Hy", value: "hy" },
84
+ { text: "Ini, TOML", value: "ini" },
85
+ { text: "Inform7", value: "inform7" },
86
+ { text: "IRPF90", value: "irpf90" },
87
+ { text: "Julia", value: "julia" },
88
+ { text: "Kotlin", value: "kotlin" },
89
+ { text: "LaTeX", value: "tex" },
90
+ { text: "Leaf", value: "leaf" },
91
+ { text: "Lasso", value: "lasso" },
92
+ { text: "Less", value: "less" },
93
+ { text: "LDIF", value: "ldif" },
94
+ { text: "Lisp", value: "lisp" },
95
+ { text: "LiveCode Server", value: "livecodeserver" },
96
+ { text: "LiveScript", value: "livescript" },
97
+ { text: "Makefile", value: "makefile" },
98
+ { text: "Markdown", value: "markdown" },
99
+ { text: "Mathematica", value: "mathematica" },
100
+ { text: "Matlab", value: "matlab" },
101
+ { text: "Maxima", value: "maxima" },
102
+ { text: "Maya Embedded Language", value: "mel" },
103
+ { text: "Mercury", value: "mercury" },
104
+ { text: "Mizar", value: "mizar" },
105
+ { text: "Mojolicious", value: "mojolicious" },
106
+ { text: "Monkey", value: "monkey" },
107
+ { text: "Moonscript", value: "moonscript" },
108
+ { text: "N1QL", value: "n1ql" },
109
+ { text: "NSIS", value: "nsis" },
110
+ { text: "Nginx", value: "nginx" },
111
+ { text: "Nim", value: "nim" },
112
+ { text: "Nix", value: "nix" },
113
+ { text: "OCaml", value: "ocaml" },
114
+ { text: "Objective C", value: "objectivec" },
115
+ { text: "OpenGL Shading Language", value: "glsl" },
116
+ { text: "OpenSCAD", value: "openscad" },
117
+ { text: "Oracle Rules Language", value: "ruleslanguage" },
118
+ { text: "Oxygene", value: "oxygene" },
119
+ { text: "PF", value: "pf" },
120
+ { text: "PHP", value: "php" },
121
+ { text: "Parser3", value: "parser3" },
122
+ { text: "Perl", value: "perl" },
123
+ { text: "Plaintext", value: "plaintext" },
124
+ { text: "Pony", value: "pony" },
125
+ { text: "PostgreSQL & PL/pgSQL", value: "pgsql" },
126
+ { text: "PowerShell", value: "powershell" },
127
+ { text: "Processing", value: "processing" },
128
+ { text: "Prolog", value: "prolog" },
129
+ { text: "Properties", value: "properties" },
130
+ { text: "Protocol Buffers", value: "protobuf" },
131
+ { text: "Puppet", value: "puppet" },
132
+ { text: "Python profiler results", value: "profile" },
133
+ { text: "Python REPL", value: "python-repl" },
134
+ { text: "Q", value: "k" },
135
+ { text: "QML", value: "qml" },
136
+ { text: "R", value: "r" },
137
+ { text: "ReasonML", value: "reasonml" },
138
+ { text: "RenderMan RIB", value: "rib" },
139
+ { text: "RenderMan RSL", value: "rsl" },
140
+ { text: "Roboconf", value: "graph" },
141
+ { text: "Ruby", value: "ruby" },
142
+ { text: "Rust", value: "rust" },
143
+ { text: "SAS", value: "SAS" },
144
+ { text: "SCSS", value: "scss" },
145
+ { text: "SQL", value: "sql" },
146
+ { text: "STEP Part 21", value: "p21" },
147
+ { text: "Scala", value: "scala" },
148
+ { text: "Scheme", value: "scheme" },
149
+ { text: "Scilab", value: "scilab" },
150
+ { text: "Shell", value: "shell" },
151
+ { text: "Smali", value: "smali" },
152
+ { text: "Smalltalk", value: "smalltalk" },
153
+ { text: "SML", value: "sml" },
154
+ { text: "Stan", value: "stan" },
155
+ { text: "Stata", value: "stata" },
156
+ { text: "Stylus", value: "stylus" },
157
+ { text: "SubUnit", value: "subunit" },
158
+ { text: "Swift", value: "swift" },
159
+ { text: "Tcl", value: "tcl" },
160
+ { text: "Test Anything Protocol", value: "tap" },
161
+ { text: "Thrift", value: "thrift" },
162
+ { text: "TP", value: "tp" },
163
+ { text: "Twig", value: "twig" },
164
+ { text: "TypeScript", value: "typescript" },
165
+ { text: "VB.Net", value: "vbnet" },
166
+ { text: "VBScript", value: "vbscript" },
167
+ { text: "VHDL", value: "vhdl" },
168
+ { text: "Vala", value: "vala" },
169
+ { text: "Verilog", value: "verilog" },
170
+ { text: "Vim Script", value: "vim" },
171
+ { text: "X++", value: "axapta" },
172
+ { text: "x86 Assembly", value: "x86asm" },
173
+ { text: "XL", value: "xl" },
174
+ { text: "XQuery", value: "xquery" },
175
+ { text: "YAML", value: "yml" },
176
+ { text: "Zephir", value: "zephir" },
177
+ ];
@@ -0,0 +1,30 @@
1
+ import $ from "jquery";
2
+ function buildIframe(str){
3
+ let _str = new URLSearchParams(str);
4
+ let mode = _str.get('mode')
5
+
6
+ if(mode == 'vertical'){
7
+ return `<iframe class="w-pz-iframe" src="${str}" scrolling="no" width="750" height="3468" style="border:none;background:none;max-width:100%;overflow:hidden;"></iframe>`
8
+ }else{
9
+ return `<iframe class="w-pz-iframe" src="${str}" scrolling="no" width="1280" height="720" style="border:none;background:none;max-width:100%;overflow:hidden;"></iframe>`
10
+ }
11
+ }
12
+
13
+ function renderPzIframe(selector = ".e-pz-iframe"){
14
+ try {
15
+ $(selector).each(function(i, ele) {
16
+ // 获取嵌入源地址
17
+ let url = $(this).text();
18
+
19
+ // 构建嵌入源码
20
+ let code = buildIframe(url)
21
+
22
+ // 挂载点
23
+ $(this).after(code);
24
+ });
25
+ } catch (e) {
26
+ console.error(e);
27
+ }
28
+ }
29
+
30
+ export default renderPzIframe
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-editor",
3
- "version": "1.1.4",
3
+ "version": "1.1.8",
4
4
  "description": "JX3BOX Article & Editor",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Article.vue CHANGED
@@ -90,6 +90,7 @@ import renderTalent2 from "../assets/js/talent2";
90
90
  import renderKatex from "../assets/js/katex";
91
91
  import renderCode from "../assets/js/code";
92
92
  import renderImgPreview from "../assets/js/renderImgPreview";
93
+ import renderPzIframe from '../assets/js/pz_iframe'
93
94
 
94
95
  // 剑三
95
96
  import Item from "./Item";
@@ -191,6 +192,8 @@ export default {
191
192
  renderTalent2();
192
193
  // 物品
193
194
  renderJx3Element(this);
195
+ // 配装
196
+ renderPzIframe();
194
197
  },
195
198
  doDir: function () {
196
199
  // 显示局部
package/src/Tinymce.vue CHANGED
@@ -22,7 +22,7 @@
22
22
  >进入特殊区域(代码块,折叠块等等)脱离或使用工具栏触发后,请使用键盘方向
23
23
  → ↓
24
24
  键进行脱离,回车只是正常在区块内换行。去掉样式点击第二行第一个&lt;清除格式&gt;即可复位。<a
25
- href="https://www.jx3box.com/tool/16227"
25
+ href="/tool/16227"
26
26
  target="_blank"
27
27
  >[编辑器使用指南]</a
28
28
  >
@@ -39,6 +39,7 @@ import Resource from "./Resource";
39
39
  import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
40
40
  import { __ossRoot } from "@jx3box/jx3box-common/data/jx3box.json";
41
41
  import Emotion from "@jx3box/jx3box-emotion/src/Emotion.vue"
42
+ import hljs_languages from "../assets/js/item/hljs_languages.js"
42
43
  const API_Root = process.env.NODE_ENV === "production" ? __cms : "/";
43
44
  const API = API_Root + "api/cms/upload/tinymce";
44
45
 
@@ -59,8 +60,10 @@ export default {
59
60
  convert_urls: false,
60
61
 
61
62
  // 样式
63
+ // TODO:
62
64
  content_css: `https://oss.jx3box.com/static/tinymce/skins/content/default/content.min.css`,
63
- body_class: "c-article c-article-editor",
65
+ // content_css: `http://localhost:5000/skins/content/default/content.min.css`,
66
+ body_class: "c-article c-article-editor c-article-tinymce",
64
67
  height: this.height || 800,
65
68
  autosave_ask_before_unload: false,
66
69
 
@@ -141,6 +144,8 @@ export default {
141
144
  "黑色",
142
145
  ],
143
146
 
147
+ codesample_languages: hljs_languages,
148
+
144
149
  // Image
145
150
  image_advtab: true,
146
151
  // paste_data_images: true,