assui 2.0.48 → 2.0.52
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/es/rich-text-editor/index.d.ts +0 -1
- package/es/rich-text-editor/index.js +4 -2
- package/es/rich-text-editor/plugins/code/index.d.ts +2 -0
- package/es/rich-text-editor/plugins/code/index.js +83 -0
- package/lib/rich-text-editor/index.d.ts +0 -1
- package/lib/rich-text-editor/index.js +4 -2
- package/lib/rich-text-editor/plugins/code/index.d.ts +2 -0
- package/lib/rich-text-editor/plugins/code/index.js +95 -0
- package/package.json +3 -3
|
@@ -12,7 +12,6 @@ import 'tinymce/plugins/hr';
|
|
|
12
12
|
import 'tinymce/plugins/anchor';
|
|
13
13
|
import 'tinymce/plugins/searchreplace';
|
|
14
14
|
import 'tinymce/plugins/wordcount';
|
|
15
|
-
import 'tinymce/plugins/code';
|
|
16
15
|
import 'tinymce/plugins/fullscreen';
|
|
17
16
|
import 'tinymce/plugins/insertdatetime';
|
|
18
17
|
import 'tinymce/plugins/media';
|
|
@@ -44,8 +44,8 @@ import 'tinymce/plugins/charmap';
|
|
|
44
44
|
import 'tinymce/plugins/hr';
|
|
45
45
|
import 'tinymce/plugins/anchor';
|
|
46
46
|
import 'tinymce/plugins/searchreplace';
|
|
47
|
-
import 'tinymce/plugins/wordcount';
|
|
48
|
-
|
|
47
|
+
import 'tinymce/plugins/wordcount'; // import 'tinymce/plugins/code';
|
|
48
|
+
|
|
49
49
|
import 'tinymce/plugins/fullscreen';
|
|
50
50
|
import 'tinymce/plugins/insertdatetime';
|
|
51
51
|
import 'tinymce/plugins/media';
|
|
@@ -53,8 +53,10 @@ import 'tinymce/plugins/nonbreaking';
|
|
|
53
53
|
import 'tinymce/plugins/table';
|
|
54
54
|
import 'tinymce/plugins/template';
|
|
55
55
|
import 'tinymce/plugins/help';
|
|
56
|
+
import initCodePlugin from './plugins/code';
|
|
56
57
|
import zhCN from './lang/zh_CN';
|
|
57
58
|
tinymce.addI18n('zh_CN', zhCN);
|
|
59
|
+
initCodePlugin();
|
|
58
60
|
var defaultPlugins = ['autolink lists link image charmap anchor', 'searchreplace code fullscreen', 'insertdatetime media table help wordcount'];
|
|
59
61
|
var defaultToolbar = 'undo redo | formatselect | ' + 'code bold italic color fontcolor backcolor | alignleft aligncenter ' + 'alignright alignjustify table | image bullist numlist outdent indent | ' + 'removeformat | help';
|
|
60
62
|
var defaultInit = {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import tinymce from 'tinymce/tinymce';
|
|
3
|
+
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
4
|
+
|
|
5
|
+
var setContent = function setContent(editor, html) {
|
|
6
|
+
editor.focus();
|
|
7
|
+
editor.undoManager.transact(function () {
|
|
8
|
+
editor.setContent(html);
|
|
9
|
+
});
|
|
10
|
+
editor.selection.setCursorLocation();
|
|
11
|
+
editor.nodeChanged();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var getContent = function getContent(editor) {
|
|
15
|
+
return editor.getContent({
|
|
16
|
+
source_view: true
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var open = function open(editor) {
|
|
21
|
+
var editorContent = getContent(editor);
|
|
22
|
+
editor.windowManager.open({
|
|
23
|
+
title: 'Source Code',
|
|
24
|
+
size: 'large',
|
|
25
|
+
body: {
|
|
26
|
+
type: 'panel',
|
|
27
|
+
items: [{
|
|
28
|
+
type: 'textarea',
|
|
29
|
+
name: 'code'
|
|
30
|
+
}]
|
|
31
|
+
},
|
|
32
|
+
buttons: [{
|
|
33
|
+
type: 'cancel',
|
|
34
|
+
name: 'cancel',
|
|
35
|
+
text: 'Cancel'
|
|
36
|
+
}, {
|
|
37
|
+
type: 'submit',
|
|
38
|
+
name: 'save',
|
|
39
|
+
text: 'Save',
|
|
40
|
+
primary: true
|
|
41
|
+
}],
|
|
42
|
+
initialData: {
|
|
43
|
+
code: editorContent
|
|
44
|
+
},
|
|
45
|
+
onSubmit: function onSubmit(api) {
|
|
46
|
+
setContent(editor, api.getData().code);
|
|
47
|
+
api.close();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var register$1 = function register$1(editor) {
|
|
53
|
+
editor.addCommand('mceCodeEditor', function () {
|
|
54
|
+
open(editor);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var register = function register(editor) {
|
|
59
|
+
var onAction = function onAction() {
|
|
60
|
+
return editor.execCommand('mceCodeEditor');
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
editor.ui.registry.addButton('code', {
|
|
64
|
+
text: 'Source code',
|
|
65
|
+
tooltip: 'Source code',
|
|
66
|
+
onAction: onAction
|
|
67
|
+
});
|
|
68
|
+
editor.ui.registry.addMenuItem('code', {
|
|
69
|
+
icon: 'sourcecode',
|
|
70
|
+
text: 'Source code',
|
|
71
|
+
onAction: onAction
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
function initCodePlugin() {
|
|
76
|
+
global.add('code', function (editor) {
|
|
77
|
+
register$1(editor);
|
|
78
|
+
register(editor);
|
|
79
|
+
return {};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default initCodePlugin;
|
|
@@ -12,7 +12,6 @@ import 'tinymce/plugins/hr';
|
|
|
12
12
|
import 'tinymce/plugins/anchor';
|
|
13
13
|
import 'tinymce/plugins/searchreplace';
|
|
14
14
|
import 'tinymce/plugins/wordcount';
|
|
15
|
-
import 'tinymce/plugins/code';
|
|
16
15
|
import 'tinymce/plugins/fullscreen';
|
|
17
16
|
import 'tinymce/plugins/insertdatetime';
|
|
18
17
|
import 'tinymce/plugins/media';
|
|
@@ -72,9 +72,8 @@ require("tinymce/plugins/anchor");
|
|
|
72
72
|
|
|
73
73
|
require("tinymce/plugins/searchreplace");
|
|
74
74
|
|
|
75
|
-
require("tinymce/plugins/wordcount");
|
|
75
|
+
require("tinymce/plugins/wordcount"); // import 'tinymce/plugins/code';
|
|
76
76
|
|
|
77
|
-
require("tinymce/plugins/code");
|
|
78
77
|
|
|
79
78
|
require("tinymce/plugins/fullscreen");
|
|
80
79
|
|
|
@@ -90,9 +89,12 @@ require("tinymce/plugins/template");
|
|
|
90
89
|
|
|
91
90
|
require("tinymce/plugins/help");
|
|
92
91
|
|
|
92
|
+
var code_1 = __importDefault(require("./plugins/code"));
|
|
93
|
+
|
|
93
94
|
var zh_CN_1 = __importDefault(require("./lang/zh_CN"));
|
|
94
95
|
|
|
95
96
|
tinymce_1["default"].addI18n('zh_CN', zh_CN_1["default"]);
|
|
97
|
+
code_1["default"]();
|
|
96
98
|
var defaultPlugins = ['autolink lists link image charmap anchor', 'searchreplace code fullscreen', 'insertdatetime media table help wordcount'];
|
|
97
99
|
exports.defaultPlugins = defaultPlugins;
|
|
98
100
|
var defaultToolbar = 'undo redo | formatselect | ' + 'code bold italic color fontcolor backcolor | alignleft aligncenter ' + 'alignright alignjustify table | image bullist numlist outdent indent | ' + 'removeformat | help';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
}); // @ts-nocheck
|
|
12
|
+
|
|
13
|
+
var tinymce_1 = __importDefault(require("tinymce/tinymce"));
|
|
14
|
+
|
|
15
|
+
var global = tinymce_1["default"].util.Tools.resolve('tinymce.PluginManager');
|
|
16
|
+
|
|
17
|
+
var setContent = function setContent(editor, html) {
|
|
18
|
+
editor.focus();
|
|
19
|
+
editor.undoManager.transact(function () {
|
|
20
|
+
editor.setContent(html);
|
|
21
|
+
});
|
|
22
|
+
editor.selection.setCursorLocation();
|
|
23
|
+
editor.nodeChanged();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var getContent = function getContent(editor) {
|
|
27
|
+
return editor.getContent({
|
|
28
|
+
source_view: true
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var open = function open(editor) {
|
|
33
|
+
var editorContent = getContent(editor);
|
|
34
|
+
editor.windowManager.open({
|
|
35
|
+
title: 'Source Code',
|
|
36
|
+
size: 'large',
|
|
37
|
+
body: {
|
|
38
|
+
type: 'panel',
|
|
39
|
+
items: [{
|
|
40
|
+
type: 'textarea',
|
|
41
|
+
name: 'code'
|
|
42
|
+
}]
|
|
43
|
+
},
|
|
44
|
+
buttons: [{
|
|
45
|
+
type: 'cancel',
|
|
46
|
+
name: 'cancel',
|
|
47
|
+
text: 'Cancel'
|
|
48
|
+
}, {
|
|
49
|
+
type: 'submit',
|
|
50
|
+
name: 'save',
|
|
51
|
+
text: 'Save',
|
|
52
|
+
primary: true
|
|
53
|
+
}],
|
|
54
|
+
initialData: {
|
|
55
|
+
code: editorContent
|
|
56
|
+
},
|
|
57
|
+
onSubmit: function onSubmit(api) {
|
|
58
|
+
setContent(editor, api.getData().code);
|
|
59
|
+
api.close();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var register$1 = function register$1(editor) {
|
|
65
|
+
editor.addCommand('mceCodeEditor', function () {
|
|
66
|
+
open(editor);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var register = function register(editor) {
|
|
71
|
+
var onAction = function onAction() {
|
|
72
|
+
return editor.execCommand('mceCodeEditor');
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
editor.ui.registry.addButton('code', {
|
|
76
|
+
text: 'Source code',
|
|
77
|
+
tooltip: 'Source code',
|
|
78
|
+
onAction: onAction
|
|
79
|
+
});
|
|
80
|
+
editor.ui.registry.addMenuItem('code', {
|
|
81
|
+
icon: 'sourcecode',
|
|
82
|
+
text: 'Source code',
|
|
83
|
+
onAction: onAction
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function initCodePlugin() {
|
|
88
|
+
global.add('code', function (editor) {
|
|
89
|
+
register$1(editor);
|
|
90
|
+
register(editor);
|
|
91
|
+
return {};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
exports["default"] = initCodePlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.52",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@ahooksjs/use-url-state": "^2.5.8",
|
|
34
34
|
"@tinymce/tinymce-react": "^3.13.0",
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
|
-
"a-icons": "^1.0.
|
|
36
|
+
"a-icons": "^1.0.26",
|
|
37
37
|
"ahooks": "^2.10.9",
|
|
38
38
|
"bignumber.js": "^9.0.1",
|
|
39
39
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"node": ">=10.0.0"
|
|
70
70
|
},
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6ec4e53867e1bc3c9aa608571d45596af032064c"
|
|
73
73
|
}
|