@lobehub/editor 1.20.1 → 1.20.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.
|
@@ -3,7 +3,7 @@ export interface CommonPluginOptions {
|
|
|
3
3
|
enableHotkey?: boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Enable/disable markdown shortcuts
|
|
6
|
-
* @default true -
|
|
6
|
+
* @default true - most formats enabled, but subscript/superscript are disabled by default
|
|
7
7
|
*/
|
|
8
8
|
markdownOption?: boolean | {
|
|
9
9
|
bold?: boolean;
|
|
@@ -12,6 +12,8 @@ export interface CommonPluginOptions {
|
|
|
12
12
|
italic?: boolean;
|
|
13
13
|
quote?: boolean;
|
|
14
14
|
strikethrough?: boolean;
|
|
15
|
+
subscript?: boolean;
|
|
16
|
+
superscript?: boolean;
|
|
15
17
|
underline?: boolean;
|
|
16
18
|
underlineStrikethrough?: boolean;
|
|
17
19
|
};
|
|
@@ -91,16 +91,21 @@ export var CommonPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
91
91
|
header: true,
|
|
92
92
|
italic: true,
|
|
93
93
|
quote: true,
|
|
94
|
-
strikethrough: true
|
|
94
|
+
strikethrough: true,
|
|
95
|
+
subscript: false,
|
|
96
|
+
// Disabled by default
|
|
97
|
+
superscript: false // Disabled by default
|
|
95
98
|
// Note: code, underline, underlineStrikethrough are handled by other plugins/writers
|
|
96
99
|
};
|
|
97
100
|
if (_typeof(markdownOption) === 'object') {
|
|
98
|
-
var _markdownOption$bold, _markdownOption$heade, _markdownOption$itali, _markdownOption$quote, _markdownOption$strik;
|
|
101
|
+
var _markdownOption$bold, _markdownOption$heade, _markdownOption$itali, _markdownOption$quote, _markdownOption$strik, _markdownOption$subsc, _markdownOption$super;
|
|
99
102
|
formats.bold = (_markdownOption$bold = markdownOption.bold) !== null && _markdownOption$bold !== void 0 ? _markdownOption$bold : true;
|
|
100
103
|
formats.header = (_markdownOption$heade = markdownOption.header) !== null && _markdownOption$heade !== void 0 ? _markdownOption$heade : true;
|
|
101
104
|
formats.italic = (_markdownOption$itali = markdownOption.italic) !== null && _markdownOption$itali !== void 0 ? _markdownOption$itali : true;
|
|
102
105
|
formats.quote = (_markdownOption$quote = markdownOption.quote) !== null && _markdownOption$quote !== void 0 ? _markdownOption$quote : true;
|
|
103
106
|
formats.strikethrough = (_markdownOption$strik = markdownOption.strikethrough) !== null && _markdownOption$strik !== void 0 ? _markdownOption$strik : true;
|
|
107
|
+
formats.subscript = (_markdownOption$subsc = markdownOption.subscript) !== null && _markdownOption$subsc !== void 0 ? _markdownOption$subsc : false;
|
|
108
|
+
formats.superscript = (_markdownOption$super = markdownOption.superscript) !== null && _markdownOption$super !== void 0 ? _markdownOption$super : false;
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
// Register quote shortcut if enabled
|
|
@@ -175,17 +180,20 @@ export var CommonPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
175
180
|
type: 'text-format'
|
|
176
181
|
});
|
|
177
182
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
if (formats.superscript) {
|
|
184
|
+
textFormatShortcuts.push({
|
|
185
|
+
format: ['superscript'],
|
|
186
|
+
tag: '^',
|
|
187
|
+
type: 'text-format'
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (formats.subscript) {
|
|
191
|
+
textFormatShortcuts.push({
|
|
192
|
+
format: ['subscript'],
|
|
193
|
+
tag: '~',
|
|
194
|
+
type: 'text-format'
|
|
195
|
+
});
|
|
196
|
+
}
|
|
189
197
|
if (textFormatShortcuts.length > 0) {
|
|
190
198
|
markdownService.registerMarkdownShortCuts(textFormatShortcuts);
|
|
191
199
|
}
|
|
@@ -5,6 +5,8 @@ export declare const useThemeStyles: (props?: boolean | {
|
|
|
5
5
|
italic?: boolean | undefined;
|
|
6
6
|
quote?: boolean | undefined;
|
|
7
7
|
strikethrough?: boolean | undefined;
|
|
8
|
+
subscript?: boolean | undefined;
|
|
9
|
+
superscript?: boolean | undefined;
|
|
8
10
|
underline?: boolean | undefined;
|
|
9
11
|
underlineStrikethrough?: boolean | undefined;
|
|
10
12
|
} | undefined) => import("antd-style").ReturnStyles<{
|
package/package.json
CHANGED