统计与状态
editor.getStats();
-// => { characters, words, chineseChars, englishWords, lines, readingTime }
+// => { characters, words, chineseChars, englishWords, lines, readingTime }
editor.getStatus();
-// => { id, mode, theme, locale, fullscreen, readOnly, disabled, destroyed, plugins }
+// => { id, mode, theme, locale, fullscreen, readOnly, disabled, destroyed, plugins }
@@ -445,7 +445,7 @@ MeEditor.use.use(customPlugin);
// 全局事件钩子
-MeEditor.on('beforeCreate', (editor) => {});
+MeEditor.on('beforeCreate', (editor) => {});
MeEditor.off('beforeCreate', handler);
// 主题与语言
@@ -453,16 +453,16 @@ MeEditor.setTheme.setLocale('en-US');
// 状态查询
-MeEditor.getStatus(); // => { version, theme, locale, globalPlugins, presetPlugins }
+MeEditor.getStatus(); // => { version, theme, locale, globalPlugins, presetPlugins }
// 销毁全局资源
MeEditor.destroy();
// 内置解析器
import { parseMarkdown, safeUrl, slugify } from '@metona-team/metona-editor';
-parseMarkdown('# Hello'); // => '<h1 id="hello">Hello</h1>'
-safeUrl('javascript:alert(1)'); // => ''
-slugify('Hello World'); // => 'hello-world'
+parseMarkdown('# Hello'); // => '<h1 id="hello">Hello</h1>'
+safeUrl('javascript:alert(1)'); // => ''
+slugify('Hello World'); // => 'hello-world'
@@ -580,16 +580,16 @@ MeEditor.setLocale// 翻译函数
import { i18nUtils } from '@metona-team/metona-editor';
-i18nUtils.t('bold'); // => '粗体'(zh-CN)
-i18nUtils.t('bold'); // => 'Bold'(en-US)
+i18nUtils.t('bold'); // => '粗体'(zh-CN)
+i18nUtils.t('bold'); // => 'Bold'(en-US)
// 添加语言
i18nUtils.addTranslations('ja', { bold: '太字', italic: '斜体' });
// 格式化
-i18nUtils.formatNumber(1234567); // => '1,234,567'
-i18nUtils.formatCurrency(99.99, 'USD'); // => '$99.99'
-i18nUtils.formatDate('2024-01-15'); // => '1/15/2024'
+i18nUtils.formatNumber(1234567); // => '1,234,567'
+i18nUtils.formatCurrency(99.99, 'USD'); // => '$99.99'
+i18nUtils.formatDate('2024-01-15'); // => '1/15/2024'