remons-markdown-editor 1.0.0-beta.12 → 1.0.0-beta.13

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/dist/index.css CHANGED
@@ -41,85 +41,85 @@
41
41
  min-height: 20px;
42
42
  text-align: center;
43
43
  }
44
- html,
45
- body {
46
- margin: 0;
47
- padding: 0;
48
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
49
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
50
- sans-serif;
51
- -webkit-font-smoothing: antialiased;
52
- -moz-osx-font-smoothing: grayscale;
53
- }
54
-
55
- #markdown-editor {
56
- height: 100vh;
57
- width: 100vw;
58
- overflow: hidden;
59
- }
60
-
61
- /* ===== CSS 自定义属性(主题变量) ===== */
62
- /* 浅色主题(默认) */
63
- :root,
64
- [data-theme="light"] {
65
- /* 背景色 */
66
- --remons-md-editor-bg-primary: #f3f3f3;
67
- --remons-md-editor-bg-white: rgba(255, 255, 255, 0.6);
68
- --remons-md-editor-bg-hover: #e1e4e8;
69
- --remons-md-editor-bg-active: #d0d7de;
70
- --remons-md-editor-bg-fullscreen: #fff;
71
-
72
- /* 文字颜色 */
73
- --remons-md-editor-color-text: #24292f;
74
- --remons-md-editor-color-text-hover: #0969da;
75
-
76
- /* 边框 */
77
- --remons-md-editor-color-border: rgba(255, 255, 255, 0.8);
78
- --remons-md-editor-color-border-light: #d0d7de;
79
-
80
- /* 焦点 */
81
- --remons-md-editor-color-focus: #0969da;
82
- --remons-md-editor-color-focus-shadow: rgba(9, 105, 218, 0.1);
83
-
84
- /* 工具选择器 */
85
- --remons-md-editor-bg-picker: #fff;
86
- --remons-md-editor-bg-cell-active: #ddf4ff;
87
- --remons-md-editor-color-cell-active: #91caff;
88
- --remons-md-editor-color-hint: #999;
89
- --remons-md-editor-color-label: #666;
90
- }
91
-
92
- /* ===== 深色主题 ===== */
93
- [data-theme="dark"] {
94
- /* 背景色 */
95
- --remons-md-editor-bg-primary: #1a1d23;
96
- --remons-md-editor-bg-white: rgba(46, 51, 80, 0.8);
97
- --remons-md-editor-bg-hover: #4a5163;
98
- --remons-md-editor-bg-active: #5a6278;
99
- --remons-md-editor-bg-fullscreen: #1a1d23;
100
-
101
- /* 文字颜色 */
102
- --remons-md-editor-color-text: #c9d1d9;
103
- --remons-md-editor-color-text-hover: #58a6ff;
104
-
105
- /* 边框 */
106
- --remons-md-editor-color-border: rgba(255, 255, 255, 0.1);
107
- --remons-md-editor-color-border-light: #3a3f4b;
108
-
109
- /* 焦点 */
110
- --remons-md-editor-color-focus: #58a6ff;
111
- --remons-md-editor-color-focus-shadow: rgba(88, 166, 255, 0.15);
112
-
113
- /* 工具选择器 */
114
- --remons-md-editor-bg-picker: #2e3350;
115
- --remons-md-editor-bg-cell-active: #1a3a5c;
116
- --remons-md-editor-color-cell-active: #58a6ff;
117
- --remons-md-editor-color-hint: #8b949e;
118
- --remons-md-editor-color-label: #8b949e;
119
- }
120
-
121
- .ant-anchor-link-title {
122
- white-space: inherit !important;
44
+ html,
45
+ body {
46
+ margin: 0;
47
+ padding: 0;
48
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
49
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
50
+ sans-serif;
51
+ -webkit-font-smoothing: antialiased;
52
+ -moz-osx-font-smoothing: grayscale;
53
+ }
54
+
55
+ #markdown-editor {
56
+ height: 100vh;
57
+ width: 100vw;
58
+ overflow: hidden;
59
+ }
60
+
61
+ /* ===== CSS 自定义属性(主题变量) ===== */
62
+ /* 浅色主题(默认) */
63
+ :root,
64
+ [data-theme="light"] {
65
+ /* 背景色 */
66
+ --remons-md-editor-bg-primary: #f3f3f3;
67
+ --remons-md-editor-bg-white: rgba(255, 255, 255, 0.6);
68
+ --remons-md-editor-bg-hover: #e1e4e8;
69
+ --remons-md-editor-bg-active: #d0d7de;
70
+ --remons-md-editor-bg-fullscreen: #fff;
71
+
72
+ /* 文字颜色 */
73
+ --remons-md-editor-color-text: #24292f;
74
+ --remons-md-editor-color-text-hover: #0969da;
75
+
76
+ /* 边框 */
77
+ --remons-md-editor-color-border: rgba(255, 255, 255, 0.8);
78
+ --remons-md-editor-color-border-light: #d0d7de;
79
+
80
+ /* 焦点 */
81
+ --remons-md-editor-color-focus: #0969da;
82
+ --remons-md-editor-color-focus-shadow: rgba(9, 105, 218, 0.1);
83
+
84
+ /* 工具选择器 */
85
+ --remons-md-editor-bg-picker: #fff;
86
+ --remons-md-editor-bg-cell-active: #ddf4ff;
87
+ --remons-md-editor-color-cell-active: #91caff;
88
+ --remons-md-editor-color-hint: #999;
89
+ --remons-md-editor-color-label: #666;
90
+ }
91
+
92
+ /* ===== 深色主题 ===== */
93
+ [data-theme="dark"] {
94
+ /* 背景色 */
95
+ --remons-md-editor-bg-primary: #1a1d23;
96
+ --remons-md-editor-bg-white: rgba(46, 51, 80, 0.8);
97
+ --remons-md-editor-bg-hover: #4a5163;
98
+ --remons-md-editor-bg-active: #5a6278;
99
+ --remons-md-editor-bg-fullscreen: #1a1d23;
100
+
101
+ /* 文字颜色 */
102
+ --remons-md-editor-color-text: #c9d1d9;
103
+ --remons-md-editor-color-text-hover: #58a6ff;
104
+
105
+ /* 边框 */
106
+ --remons-md-editor-color-border: rgba(255, 255, 255, 0.1);
107
+ --remons-md-editor-color-border-light: #3a3f4b;
108
+
109
+ /* 焦点 */
110
+ --remons-md-editor-color-focus: #58a6ff;
111
+ --remons-md-editor-color-focus-shadow: rgba(88, 166, 255, 0.15);
112
+
113
+ /* 工具选择器 */
114
+ --remons-md-editor-bg-picker: #2e3350;
115
+ --remons-md-editor-bg-cell-active: #1a3a5c;
116
+ --remons-md-editor-color-cell-active: #58a6ff;
117
+ --remons-md-editor-color-hint: #8b949e;
118
+ --remons-md-editor-color-label: #8b949e;
119
+ }
120
+
121
+ .ant-anchor-link-title {
122
+ white-space: inherit !important;
123
123
  }@font-face {
124
124
  font-family: 'Inter';
125
125
  font-style: normal;
package/dist/index.js CHANGED
@@ -247,25 +247,36 @@ var containerWidgetPlugin = ViewPlugin.fromClass(class {
247
247
  }
248
248
  }, {
249
249
  decorations: (value) => value.decorations,
250
- eventHandlers: { click: (event, view) => {
251
- const target = event.target;
252
- if (target.classList.contains("container-edit-btn")) {
253
- if (target.__typeName) {
254
- const containers = findContainers(view.state.doc.toString());
255
- const buttonPos = view.posAtDOM(target);
256
- for (const container of containers) {
257
- const headerLine = view.state.doc.lineAt(container.startPos);
258
- if (buttonPos >= headerLine.from - 5 && buttonPos <= headerLine.to + 5) {
259
- const callback = view.state.facet(containerEditCallback);
260
- if (callback) callback(view, container.typeName, container.propsLineFrom, container.propsLineTo, { ...container.props });
261
- return true;
250
+ eventHandlers: {
251
+ mousedown: (event, view) => {
252
+ if (event.target.classList.contains("container-edit-btn")) {
253
+ event.preventDefault();
254
+ return true;
255
+ }
256
+ return false;
257
+ },
258
+ click: (event, view) => {
259
+ const target = event.target;
260
+ if (target.classList.contains("container-edit-btn")) {
261
+ event.preventDefault();
262
+ event.stopPropagation();
263
+ if (target.__typeName) {
264
+ const containers = findContainers(view.state.doc.toString());
265
+ const buttonPos = view.posAtDOM(target);
266
+ for (const container of containers) {
267
+ const headerLine = view.state.doc.lineAt(container.startPos);
268
+ if (buttonPos >= headerLine.from - 5 && buttonPos <= headerLine.to + 5) {
269
+ const callback = view.state.facet(containerEditCallback);
270
+ if (callback) callback(view, container.typeName, container.propsLineFrom, container.propsLineTo, { ...container.props });
271
+ return true;
272
+ }
262
273
  }
263
274
  }
275
+ return false;
264
276
  }
265
277
  return false;
266
278
  }
267
- return false;
268
- } }
279
+ }
269
280
  });
270
281
  //#endregion
271
282
  //#region src/components/Toolbar/buttons.tsx