@seafile/seafile-editor 0.3.99 → 0.3.100

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.
Files changed (90) hide show
  1. package/dist/_i18n/index.js +20 -0
  2. package/dist/assets/css/comment-dialog.css +50 -0
  3. package/dist/{css → assets/css}/diff-viewer.css +0 -0
  4. package/dist/{css/richeditor → assets/css}/formula.css +0 -0
  5. package/dist/{css → assets/css}/history-viewer.css +0 -0
  6. package/dist/{css/richeditor → assets/css}/image.css +0 -0
  7. package/dist/{index.css → assets/css/index.css} +0 -0
  8. package/dist/assets/css/issue-card.css +43 -0
  9. package/dist/{css → assets/css}/keyboard-shortcuts.css +0 -0
  10. package/dist/{css/richeditor → assets/css}/link.css +0 -0
  11. package/dist/{css/plaineditor → assets/css}/markdown-editor.css +0 -0
  12. package/dist/{css → assets/css}/markdown-viewer.css +0 -0
  13. package/dist/{css/richeditor → assets/css}/navbar-imgbutton.css +0 -0
  14. package/dist/assets/css/outline.css +29 -0
  15. package/dist/{css/richeditor → assets/css}/table.css +0 -0
  16. package/dist/{css/richeditor → assets/css}/textlink-hovermenu.css +0 -0
  17. package/dist/{css → assets/css}/topbar.css +19 -33
  18. package/dist/{css/richeditor → assets/css}/tree-view.css +0 -0
  19. package/dist/{css/richeditor/right-panel.css → assets/css/user-help.css} +9 -9
  20. package/dist/assets/editor/plain-editor.css +30 -0
  21. package/dist/assets/editor/rich-editor.css +104 -0
  22. package/dist/assets/editor/simple-editor.css +77 -0
  23. package/dist/{css/richeditor → assets/rich-editor}/document-info.css +0 -0
  24. package/dist/components/add-formula-dialog.js +6 -4
  25. package/dist/components/add-image-dialog.js +3 -1
  26. package/dist/components/add-link-dialog.js +4 -3
  27. package/dist/components/comment-dialog.js +12 -6
  28. package/dist/components/markdown-lint.js +1 -0
  29. package/dist/components/outline/index.js +97 -0
  30. package/dist/components/outline/outline-item.js +70 -0
  31. package/dist/components/shortcut-dialog.js +1 -1
  32. package/dist/components/{topbar-component → toolbar}/header-list.js +0 -0
  33. package/dist/components/toolbar/help-group.js +40 -0
  34. package/dist/components/toolbar/index.js +4 -0
  35. package/dist/components/{topbar-component/upload-img.js → toolbar/insert-image.js} +18 -15
  36. package/dist/components/toolbar/insert-table.js +155 -0
  37. package/dist/components/toolbar/table-group.js +82 -0
  38. package/dist/components/{toolbar.js → toolbar/toolbar.js} +102 -64
  39. package/dist/components/{topbar-component → toolbar/widgets}/button-group.js +0 -0
  40. package/dist/components/toolbar/widgets/button-item.js +144 -0
  41. package/dist/components/toolbar/widgets/drop-list.js +101 -0
  42. package/dist/components/user-help.js +16 -10
  43. package/dist/editor/controller/block-element-controller.js +6 -2
  44. package/dist/editor/controller/inline-element-controller.js +6 -2
  45. package/dist/editor/editor-builder.js +107 -0
  46. package/dist/editor/editor-component/formula.js +4 -2
  47. package/dist/editor/editor-component/image.js +10 -6
  48. package/dist/editor/editor-component/table.js +1 -1
  49. package/dist/editor/editor-plugin.js +3 -1
  50. package/dist/editor/editor.js +1 -32
  51. package/dist/editor/index.js +97 -0
  52. package/dist/editor/markdown-editor.js +323 -0
  53. package/dist/editor/plain-markdown-editor.js +5 -4
  54. package/dist/editor/rich-markdown-editor.js +70 -149
  55. package/dist/editor/simple-editor.js +44 -78
  56. package/dist/{css/richeditor → example/assets/css}/comments-list.css +0 -45
  57. package/dist/{css/richeditor → example/assets/css}/detail-list-view.css +0 -0
  58. package/dist/{css/richeditor → example/assets/css}/participants-list.css +0 -0
  59. package/dist/{css → example/assets/css}/react-mentions-default-style.js +0 -0
  60. package/dist/example/assets/css/seafile-editor-main.css +125 -0
  61. package/dist/example/assets/css/seafile-editor-side.css +89 -0
  62. package/dist/example/assets/css/side-panel.css +81 -0
  63. package/dist/{components → example/components}/comment-panel.js +12 -6
  64. package/dist/{components → example/components}/detail-list-view.js +1 -1
  65. package/dist/{components → example/components}/participants-list.js +1 -1
  66. package/dist/{components → example/components}/side-panel.js +5 -7
  67. package/dist/example/seafile-editor.js +137 -0
  68. package/dist/index.js +9 -0
  69. package/dist/index.local.js +58 -0
  70. package/dist/pages/seafile-editor/index.js +38 -0
  71. package/dist/{editor → pages/seafile-editor}/seafile-editor.js +19 -35
  72. package/dist/{seafile-editor-chooser.js → pages/seafile-editor-chooser.js} +0 -0
  73. package/dist/{seafile-markdown-editor.js → pages/seafile-markdown-editor.js} +5 -5
  74. package/dist/{seafile-markdown-viewer.js → pages/seafile-markdown-viewer.js} +3 -3
  75. package/dist/{seafile-simple-editor.js → pages/seafile-simple-editor.js} +5 -2
  76. package/dist/viewer/diff-viewer.js +1 -1
  77. package/dist/viewer/markdown-viewer.js +14 -15
  78. package/dist/viewer/slate-viewer.js +9 -24
  79. package/dist/viewer/viewer-formula.js +1 -1
  80. package/package.json +5 -13
  81. package/dist/components/generate-share-link.js +0 -412
  82. package/dist/components/internal-link-dialog.js +0 -96
  83. package/dist/components/outline.js +0 -130
  84. package/dist/components/topbar-component/icon-button.js +0 -99
  85. package/dist/components/topbar-component/insert-file.js +0 -67
  86. package/dist/components/topbar-component/table-toolbar.js +0 -175
  87. package/dist/css/layout.css +0 -111
  88. package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
  89. package/dist/css/richeditor/rich-editor-main.css +0 -32
  90. package/dist/css/richeditor/side-panel.css +0 -183
@@ -1,99 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import React from 'react';
7
- import { Tooltip } from 'reactstrap';
8
- import { withTranslation } from 'react-i18next';
9
-
10
- var IconButton = /*#__PURE__*/function (_React$Component) {
11
- _inherits(IconButton, _React$Component);
12
-
13
- var _super = _createSuper(IconButton);
14
-
15
- function IconButton(props) {
16
- var _this;
17
-
18
- _classCallCheck(this, IconButton);
19
-
20
- _this = _super.call(this, props);
21
-
22
- _this.toggle = function () {
23
- if (_this.props.disabled || _this.state.isFreezed && !_this.state.tooltipOpen) return;
24
-
25
- _this.setState({
26
- tooltipOpen: !_this.state.tooltipOpen,
27
- isFreezed: true
28
- });
29
-
30
- var that = _assertThisInitialized(_this);
31
-
32
- setTimeout(function () {
33
- that.setState({
34
- isFreezed: false
35
- });
36
- }, 100);
37
- };
38
-
39
- _this.getClassName = function () {
40
- var className = _this.props.isRichEditor ? 'rich-icon-btn ' + (_this.props.disabled ? 'rich-icon-btn-disabled' : 'rich-icon-btn-hover') : 'btn btn-icon btn-secondary btn-active';
41
- className = className + ' ' + (_this.props.className || '');
42
- return className;
43
- };
44
-
45
- _this.state = {
46
- tooltipOpen: false,
47
- isFreezed: false
48
- };
49
- return _this;
50
- }
51
-
52
- _createClass(IconButton, [{
53
- key: "shouldComponentUpdate",
54
- value: function shouldComponentUpdate(nextProps, nextState) {
55
- if (this.props.disabled !== nextProps.disabled) {
56
- this.setState({
57
- tooltipOpen: false
58
- });
59
- return true;
60
- } // only render iconButton when the button is active or show show tooltip
61
-
62
-
63
- if (nextState.tooltipOpen === this.state.tooltipOpen && nextProps.isActive === this.props.isActive) {
64
- return false;
65
- }
66
-
67
- return true;
68
- }
69
- }, {
70
- key: "render",
71
- value: function render() {
72
- var className = this.getClassName();
73
- return /*#__PURE__*/React.createElement("button", {
74
- id: this.props.id,
75
- type: 'button',
76
- onClick: this.props.disabled ? null : this.props.onClick,
77
- onMouseDown: this.props.disabled ? null : this.props.onMouseDown,
78
- className: className,
79
- "data-active": this.props.isActive || false,
80
- disabled: this.props.disabled
81
- }, /*#__PURE__*/React.createElement("i", {
82
- className: this.props.icon
83
- }), /*#__PURE__*/React.createElement(Tooltip, {
84
- toggle: this.toggle,
85
- delay: {
86
- show: 0,
87
- hide: 0
88
- },
89
- target: this.props.id,
90
- placement: "bottom",
91
- isOpen: this.state.tooltipOpen
92
- }, this.props.text));
93
- }
94
- }]);
95
-
96
- return IconButton;
97
- }(React.Component);
98
-
99
- export default withTranslation('seafile-editor')(IconButton);
@@ -1,67 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
- import React from 'react';
6
- import { Tooltip } from 'reactstrap';
7
- import { withTranslation } from 'react-i18next';
8
-
9
- var InsertFile = /*#__PURE__*/function (_React$Component) {
10
- _inherits(InsertFile, _React$Component);
11
-
12
- var _super = _createSuper(InsertFile);
13
-
14
- function InsertFile(props) {
15
- var _this;
16
-
17
- _classCallCheck(this, InsertFile);
18
-
19
- _this = _super.call(this, props);
20
-
21
- _this.toggle = function () {
22
- if (_this.props.disabled) {
23
- _this.setState({
24
- tooltipOpen: false
25
- });
26
-
27
- return;
28
- } else {
29
- _this.setState({
30
- tooltipOpen: !_this.state.tooltipOpen
31
- });
32
- }
33
- };
34
-
35
- _this.state = {
36
- tooltipOpen: false
37
- };
38
- return _this;
39
- }
40
-
41
- _createClass(InsertFile, [{
42
- key: "render",
43
- value: function render() {
44
- var className = this.props.disabled ? 'insert-file insert-file-disabled rich-icon-btn rich-icon-btn-disabled' : 'insert-file rich-icon-btn';
45
- return /*#__PURE__*/React.createElement("span", {
46
- className: className,
47
- id: "insertFileButton",
48
- onMouseDown: this.props.insertRepoFile
49
- }, /*#__PURE__*/React.createElement("i", {
50
- className: "iconfont icon-file"
51
- }), /*#__PURE__*/React.createElement(Tooltip, {
52
- toggle: this.toggle,
53
- delay: {
54
- show: 0,
55
- hide: 0
56
- },
57
- target: "insertFileButton",
58
- placement: "bottom",
59
- isOpen: this.state.tooltipOpen
60
- }, this.props.t('insert_file')));
61
- }
62
- }]);
63
-
64
- return InsertFile;
65
- }(React.Component);
66
-
67
- export default withTranslation('seafile-editor')(InsertFile);
@@ -1,175 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
- import React from 'react';
6
- import ReactDOM from 'react-dom';
7
- import IconButton from './icon-button';
8
- import ButtonGroup from './button-group';
9
- import { withTranslation } from 'react-i18next';
10
-
11
- var TableToolBar = /*#__PURE__*/function (_React$PureComponent) {
12
- _inherits(TableToolBar, _React$PureComponent);
13
-
14
- var _super = _createSuper(TableToolBar);
15
-
16
- function TableToolBar() {
17
- _classCallCheck(this, TableToolBar);
18
-
19
- return _super.apply(this, arguments);
20
- }
21
-
22
- _createClass(TableToolBar, [{
23
- key: "render",
24
- value: function render() {
25
- var _this = this;
26
-
27
- return /*#__PURE__*/React.createElement(ButtonGroup, {
28
- className: 'editor-btn-group'
29
- }, /*#__PURE__*/React.createElement(DropList, {
30
- icon: 'iconfont icon-left-alignment',
31
- items: [{
32
- handle: function handle(e) {
33
- _this.props.onSetAlign(e, 'left');
34
- },
35
- icon: 'iconfont icon-left-alignment',
36
- text: this.props.t('left')
37
- }, {
38
- handle: function handle(e) {
39
- _this.props.onSetAlign(e, 'center');
40
- },
41
- icon: 'iconfont icon-center-horizontally',
42
- text: this.props.t('center')
43
- }, {
44
- handle: function handle(e) {
45
- _this.props.onSetAlign(e, 'right');
46
- },
47
- icon: 'icon icon-align-right',
48
- text: this.props.t('right')
49
- }]
50
- }), /*#__PURE__*/React.createElement(DropList, {
51
- icon: 'iconfont icon-column',
52
- items: [{
53
- handle: this.props.onInsertColumn,
54
- text: this.props.t('Insert_Column')
55
- }, {
56
- handle: this.props.onRemoveColumn,
57
- text: this.props.t('Remove_Column')
58
- }]
59
- }), /*#__PURE__*/React.createElement(DropList, {
60
- icon: 'iconfont icon-row',
61
- items: [{
62
- handle: this.props.onInsertRow,
63
- text: this.props.t('Insert_Row')
64
- }, {
65
- handle: this.props.onRemoveRow,
66
- text: this.props.t('Remove_Row')
67
- }]
68
- }), /*#__PURE__*/React.createElement(IconButton, {
69
- disabled: false,
70
- isRichEditor: true,
71
- text: this.props.t('remove_table'),
72
- id: 'removeTable',
73
- icon: 'iconfont icon-delete-table',
74
- onMouseDown: this.props.onRemoveTable
75
- }));
76
- }
77
- }]);
78
-
79
- return TableToolBar;
80
- }(React.PureComponent);
81
-
82
- var DropList = /*#__PURE__*/function (_React$PureComponent2) {
83
- _inherits(DropList, _React$PureComponent2);
84
-
85
- var _super2 = _createSuper(DropList);
86
-
87
- function DropList(props) {
88
- var _this2;
89
-
90
- _classCallCheck(this, DropList);
91
-
92
- _this2 = _super2.call(this, props);
93
-
94
- _this2.handleClick = function (event) {
95
- if (_this2.props.disabled) return;
96
-
97
- var container = _this2.getContainer();
98
-
99
- if (container.contains(event.target)) {
100
- _this2.toggle();
101
- } else {
102
- if (_this2.state.dropdownOpen) {
103
- _this2.setState({
104
- dropdownOpen: !_this2.state.dropdownOpen
105
- });
106
- }
107
- }
108
- };
109
-
110
- _this2.toggle = function () {
111
- _this2.setState({
112
- dropdownOpen: !_this2.state.dropdownOpen
113
- });
114
- };
115
-
116
- _this2.state = {
117
- dropdownOpen: false
118
- };
119
- return _this2;
120
- }
121
-
122
- _createClass(DropList, [{
123
- key: "getContainer",
124
- value: function getContainer() {
125
- return ReactDOM.findDOMNode(this);
126
- }
127
- }, {
128
- key: "componentDidMount",
129
- value: function componentDidMount() {
130
- document.addEventListener('click', this.handleClick);
131
- }
132
- }, {
133
- key: "componentWillUnmount",
134
- value: function componentWillUnmount() {
135
- document.removeEventListener('click', this.handleClick);
136
- }
137
- }, {
138
- key: "render",
139
- value: function render() {
140
- var items = [];
141
- this.props.items.forEach(function (item, index) {
142
- items.push( /*#__PURE__*/React.createElement("button", {
143
- key: 'dropdown-item' + index,
144
- onMouseDown: item.handle,
145
- className: 'dropdown-item'
146
- }, item.icon ? /*#__PURE__*/React.createElement("i", {
147
- className: item.icon,
148
- style: {
149
- marginRight: '6px'
150
- }
151
- }) : null, item.text));
152
- });
153
- return /*#__PURE__*/React.createElement("div", {
154
- className: 'custom-dropdown-list'
155
- }, /*#__PURE__*/React.createElement("div", {
156
- id: 'list_toggle',
157
- className: 'dropdown-list-toggle'
158
- }, /*#__PURE__*/React.createElement("i", {
159
- className: this.props.icon,
160
- style: {
161
- marginRight: '3px'
162
- }
163
- }), /*#__PURE__*/React.createElement("i", {
164
- className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
165
- })), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
166
- role: 'menu',
167
- className: 'custom-dropdown-menu dropdown-menu'
168
- }, items));
169
- }
170
- }]);
171
-
172
- return DropList;
173
- }(React.PureComponent);
174
-
175
- export default withTranslation('seafile-editor')(TableToolBar);
@@ -1,111 +0,0 @@
1
- /*set scroll bar*/
2
- .seafile-editor-module ::-webkit-scrollbar{
3
- width: 8px;
4
- height: 8px;
5
- }
6
-
7
- .iconfont {
8
- font-size: 13px;
9
- }
10
-
11
- .icon-drop-down {
12
- display: inline-block;
13
- transform: scale(0.8);
14
- }
15
-
16
- .icon-caret-up {
17
- display: inline-block;
18
- transform: scale(0.8);
19
- }
20
-
21
- .seafile-editor-module ::-webkit-scrollbar-button {
22
- display: none;
23
- }
24
-
25
- .seafile-editor-module ::-webkit-scrollbar-thumb {
26
- background-color: rgb(206, 206, 212);
27
- border-radius: 10px;
28
- }
29
-
30
- .seafile-editor {
31
- position: fixed;
32
- width: 100%;
33
- height: 100%;
34
- min-width: 960px;
35
- }
36
-
37
- .seafile-editor-main {
38
- height: calc(100% - 96px);
39
- width: 100%;
40
- }
41
-
42
- /* fix plain editor main height */
43
- .plain-editor-main {
44
- height: calc(100% - 68px);
45
- }
46
- .seafile-editor-topbar {
47
- width: 100%;
48
- height: 68px;
49
- background-color: #fff;
50
- padding: 0px 10px;
51
- border-bottom: 1px solid #e5e5e5;
52
- box-shadow: 0 3px 2px -2px rgba(200,200,200,.15);
53
- user-select: none;
54
- display: flex;
55
- justify-content: space-between;
56
- align-items: center;
57
- position: relative;
58
- z-index: 3;
59
- }
60
-
61
-
62
- .seafile-rich-editor-topbar {
63
- width: 100%;
64
- background-color: #fff;
65
- border-bottom: 1px solid #e5e5e5;
66
- box-shadow: 0 3px 2px -2px rgba(200,200,200,.15);
67
- user-select: none;
68
- position: relative;
69
- z-index: 3;
70
- display: flex;
71
- justify-content: space-between;
72
- }
73
-
74
- .seafile-rich-editor-topbar .use-help-icon {
75
- background-color: #fff;
76
- box-sizing: border-box;
77
- }
78
-
79
- .seafile-editor-side-panel {
80
- width: 300px;
81
- height: 100%;
82
- background-color: #fff;
83
- border-left: 1px solid rgb(230,230,221);
84
- position: relative;
85
- }
86
-
87
- .seafile-editor-main-panel {
88
- height: 100%;
89
- background-color: rgb(250,250,249);
90
- overflow-x: hidden;
91
- display: flex;
92
- flex: 0 0 1;
93
- position: relative;
94
- }
95
-
96
- .plain-editor-left-panel {
97
- height: 100%;
98
- width: 50%;
99
- background-color: #fff;
100
- border-right: 1px solid rgb(230,230,221);
101
- overflow-y: scroll;
102
- overflow-x: hidden;
103
- }
104
-
105
- .plain-editor-right-panel {
106
- height: 100%;
107
- width: 50%;
108
- background-color: rgb(250,250,249);
109
- overflow-y: scroll;
110
- overflow-x: hidden;
111
- }
@@ -1,76 +0,0 @@
1
- .sf-md-viewer-topbar-second {
2
- border-bottom: 1px solid #e5e5e5;
3
- box-shadow: 0 3px 2px -2px rgba(200,200,200,.15);
4
- }
5
-
6
- .sf-related-files-bar {
7
- display: flex;
8
- padding: 4px 8px;
9
- border-right: 1px solid #e6e6dd;
10
- }
11
-
12
- .sf-related-files-bar a {
13
- color: #212529;
14
- }
15
-
16
- .sf-related-files-bar a:hover {
17
- color: #212529;
18
- text-decoration: none;
19
- }
20
-
21
- .edit-related-file {
22
- color: #666;
23
- font-size: 14px;
24
- margin-left: 10px;
25
- cursor: pointer;
26
- }
27
-
28
- .edit-related-file:hover {
29
- text-decoration: underline;
30
- }
31
-
32
- .sf-files-tags, .no-file-tag {
33
- display: flex;
34
- flex-wrap: wrap;
35
- border-left: 1px solid #e6e6dd;
36
- border-right: 1px solid #e6e6dd;
37
- margin-bottom: 0;
38
- }
39
-
40
- .no-file-tag {
41
- padding: 4px 10px;
42
- }
43
-
44
- .no-related-file {
45
- margin: 0 2px;
46
- }
47
-
48
- .sf-files-tag {
49
- margin: 4px 8px;
50
- width: max-content;
51
- display: flex;
52
- align-items: center;
53
- }
54
-
55
- .sf-files-tag:last-child {
56
- background: none;
57
- font-size: 14px;
58
- color: #666;
59
- cursor: pointer;
60
- margin-left: 0;
61
- }
62
-
63
- .sf-files-tag:last-child:hover {
64
- text-decoration: underline;
65
- }
66
-
67
- .sf-files-tag .file-tag-icon {
68
- width: 12px;
69
- height: 12px;
70
- border-radius: 50%;
71
- }
72
-
73
- .sf-files-tag .file-tag-name {
74
- margin-left: 5px;
75
- white-space: nowrap;
76
- }
@@ -1,32 +0,0 @@
1
- .editor-main-panel {
2
- background-color: rgb(250, 250, 249);
3
- height: 100%;
4
- width: 100%;
5
- display: flex;
6
- overflow-y: auto;
7
- overflow-x: hidden;
8
- position: relative;
9
- }
10
-
11
- .editor-container {
12
- /* this container is needed to show the scroll bar */
13
- height: 100%;
14
- overflow-y: auto;
15
- flex: 1 1 auto;
16
- position: relative;
17
- }
18
- .editor {
19
- min-height: calc(100% - 40px);
20
- background: #fff;
21
- padding: 40px 60px;
22
- margin: 20px 40px;
23
- border: 1px solid rgb(230,230,221);
24
- overflow-x: hidden;
25
- }
26
-
27
- .rich-editor-container {
28
- width: 80%;
29
- flex: 1, 1, auto;
30
- height: 100%;
31
- margin: 0 auto;
32
- }