开发文档配置项默认配置

默认配置

Umo Editor 默认配置,您可以访问 https://demo.umodoc.com/editor?lang=zh-CN 来在线修改和实时预览部分配置。

所有配置

const defaultOptions = {
  editorKey: 'default',
  locale: 'zh-CN',
  theme: 'light',
  height: '100%',
  dicts: {
    fonts: [
      { label: { en_US: 'Default Font', zh_CN: '默认字体', ru_RU: 'default'}, value: null },
      { label: { en_US: 'Songti', zh_CN: '宋体', ru_RU: 'Songti' }, value: 'SimSun' },
      { label: { en_US: 'Heiti', zh_CN: '黑体', ru_RU: 'Heiti' }, value: 'SimHei' },
      { label: { en_US: 'Kaiti', zh_CN: '楷体', ru_RU: 'Kaiti' }, value: 'KaiTi' },
      {
        label: { en_US: 'Kaiti GB2312', zh_CN: '楷体_GB2312', ru_RU: 'Kaiti GB2312' },
        value: 'KaiTi_GB2312',
      },
      { label: { en_US: 'Fangsong', zh_CN: '仿宋', ru_RU: 'Fangsong' }, value: 'FangSong' },
      {
        label: { en_US: 'Fangsong GB2312', zh_CN: '仿宋_GB2312', ru_RU: 'Fangsong GB2312' },
        value: 'FangSong_GB2312',
      },
      { label: { en_US: 'STSong', zh_CN: '华文宋体', ru_RU: 'STSong' }, value: 'STSong' },
      {
        label: { en_US: 'STFangsong', zh_CN: '华文仿宋', ru_RU: 'STFangsong' },
        value: 'STFangsong',
      },
      {
        label: { en_US: 'FZ Fangsong Simplified', zh_CN: '方正仿宋简体', ru_RU: 'FZ Fangsong Simplified' },
        value: 'FZFangSong-Z02S',
      },
      {
        label: { en_US: 'FZ Xiaobiao Song', zh_CN: '方正小标宋', ru_RU: 'FZ Xiaobiao Song' },
        value: 'FZXiaoBiaoSong-B05S',
      },
      {
        label: { en_US: 'Microsoft Yahei', zh_CN: '微软雅黑', ru_RU: 'Microsoft Yahei' },
        value: 'Microsoft Yahei',
      },
      { label: 'Arial', value: 'Arial' },
      { label: 'Times New Roman', value: 'Times New Roman' },
      { label: 'Verdana', value: 'Verdana' },
      { label: 'Helvetica', value: 'Helvetica' },
      { label: 'Calibri', value: 'Calibri' },
      { label: 'Cambria', value: 'Cambria' },
      { label: 'Tahoma', value: 'Tahoma' },
      { label: 'Georgia', value: 'Georgia' },
      { label: 'Comic Sans MS', value: 'Comic Sans MS' },
      { label: 'Impact', value: 'Impact' },
    ],
    // prettier-ignore
    colors: [
			"#FFF",
			"#000",
			"#4A5366",
			"#3B74EC",
			"#45A2EF",
			"#529867",
			"#CD4A3F",
			"#EA8D40",
			"#EEC543",
			"#8E45D0",
			"#F2F2F2",
			"#7F7F7F",
			"#F4F5F7",
			"#CBDCFC",
			"#E8F6FE",
			"#EDFAF2",
			"#FCEAE9",
			"#FDF3EC",
			"#FEF9E5",
			"#FAECFE",
			"#EEE",
			"#595959",
			"#C6CAD2",
			"#CEEBFD",
			"#CBDCFC",
			"#CBE9D7",
			"#F7CBC9",
			"#FADDC7",
			"#FDEEB5",
			"#EBCAFC",
			"#BFBFBF",
			"#3F3F3F",
			"#828B9D",
			"#A0BEFA",
			"#A7DCFC",
			"#A6D5B8",
			"#F2A19C",
			"#F5BC8C",
			"#FBE281",
			"#CB94F9",
			"#A5A5A5",
			"#262626",
			"#363B44",
			"#2452B2",
			"#3473A1",
			"#417A53",
			"#922B22",
			"#AD642A",
			"#9E8329",
			"#57297D",
			"#939393",
			"#0D0D0D",
			"#25272E",
			"#15316A",
			"#1C415A",
			"#284D34",
			"#511712",
			"#573213",
			"#635217",
			"#36194E",
		],
    lineHeights: [
      { label: { en_US: 'Single', zh_CN: '单倍行距', ru_RU: 'Одинарный' }, value: 1 },
      {
        label: { en_US: '1.5 Line Spacing', zh_CN: '1.5 倍行距', ru_RU: '1.5 Межстрочных интервала' },
        value: 1.5,
        default: true,
      },
      { label: { en_US: 'Double', zh_CN: '2 倍行距', ru_RU: 'Двойной' }, value: 2 },
      { label: { en_US: '2.5 Line Spacing', zh_CN: '2.5 倍行距', ru_RU: '2.5 Межстрочных интервала' }, value: 2.5 },
      { label: { en_US: 'Triple', zh_CN: '3 倍行距', ru_RU: 'Тройной' }, value: 3 },
    ],
    symbols: [
      {
        label: { en_US: 'Plain Text', zh_CN: '普通文本', ru_RU: 'Простой Текст' },
        items: '‹›«»‘’“”‚„¡¿‥…‡‰‱‼⁈⁉⁇©®™§¶⁋',
      },
      {
        label: { en_US: 'Currency Symbols', zh_CN: '货币符号', ru_RU: 'Символы Валют' },
        items: '$€¥£¢₠₡₢₣₤¤₿₥₦₧₨₩₪₫₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽',
      },
      {
        label: { en_US: 'Mathematical Symbols', zh_CN: '数学符号', ru_RU: 'Математические Символы' },
        items: '<>≤≥–—¯‾°−±÷⁄׃∫∑∞√∼≅≈≠≡∈∉∋∏∧∨¬∩∪∂∀∃∅∇∗∝∠¼½¾',
      },
      { label: { en_US: 'Arrows', zh_CN: '箭头', ru_RU: 'Стрелки' }, items: '←→↑↓⇐⇒⇑⇓⇠⇢⇡⇣⇤⇥⤒⤓↨' },
      {
        label: { en_US: 'Latin Script', zh_CN: '拉丁语', ru_RU: 'Латинская письменность' },
        items:
          'ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ',
      },
    ],
    emojis: [
      {
        label: { en_US: 'Emotions & People', zh_CN: '表情与角色',  ru_RU: 'Эмоции & Люди' },
        items:
          '😀 😃 😄 😁 😆 😅 🤣 😂 🙂 🙃 🫠 😉 😊 😇 🥰 😍 🤩 😘 😗 ☺️ 😚 😙 🥲 😋 😛 😜 🤪 😝 🤑 🤗 🤭 🫢 🫣 🤫 🤔 🫡 🤐 🤨 😐 😑 😶 🫥 😶‍🌫️ 😏 😒 🙄 😬 😮‍💨 🤥 😌 😔 😪 🤤 😴 😷 🤒 🤕 🤢 🤮 🤧 🥵 🥶 🥴 😵 😵‍💫 🤯 🤠 🥳 🥸 😎 🤓 🧐 😕 🫤 😟 🙁 ☹️ 😮 😯 😲 😳 🥺 🥹 😦 😧 😨 😰 😥 😢 😭 😱 😖 😣 😞 😓 😩 😫 🥱 😤 😡 😠 🤬 😈 👿 💀 ☠️ 💩 🤡 👹 👺 👻 👽 👾 🤖 👋 🤚 🖐️ ✋ 🖖 🫱 🫲 🫳 🫴 👌 🤌 🤏 ✌️ 🤞 🫰 🤟 🤘 🤙 👈 👉 👆 🖕 👇 ☝️ 🫵 👍 👎 ✊ 👊 🤛 🤜 👏 🙌 🫶 👐 🤲 🤝 🙏 ✍️ 💅 🤳 💪 🦾 🦿 🦵 🦶 👂 🦻',
      },
      {
        label: { en_US: 'Animals & Nature', zh_CN: '动物与自然', ru_RU: 'Животные & Природа' },
        items:
          '🐵 🐒 🦍 🦧 🐶 🐕 🦮 🐕‍🦺 🐩 🐺 🦊 🦝 🐱 🐈 🐈‍⬛ 🦁 🐯 🐅 🐆 🐴 🐎 🦄 🦓 🦌 🦬 🐮 🐂 🐃 🐄 🐷 🐖 🐗 🐽 🐏 🐑 🐐 🐪 🐫 🦙 🦒 🐘 🦣 🦏 🦛 🐭 🐁 🐀 🐹 🐰 🐇 🐿️ 🦫 🦔 🦇 🐻 🐻‍❄️ 🐨 🐼 🦥 🦦 🦨 🦘 🦡 🐾 🦃 🐔 🐓 🐣 🐤 🐥 🐦 🐧 🕊️ 🦅 🦆 🦢 🦉 🦤 🪶 🦩 🦚 🦜 🐸 🐊 🐢 🦎 🐍 🐲 🐉 🦕 🦖 🐳 🐋 🐬 🦭 🐟 🐠 🐡 🦈 🐙 🐚 🪸 🐌 🦋 🐛 🐜 🐝 🪲 🐞 🦗 🪳 🕷️ 🕸️ 🦂 🦟 🪰 🪱 🦠 💐 🌸 💮 🪷 🏵️ 🌹 🥀 🌺 🌻 🌼 🌷 🌱 🪴 🌲 🌳 🌴 🌵 🌾 🌿 ☘️ 🍀 🍁 🍂 🍃 🪹 🪺',
      },
      {
        label: { en_US: 'Food & Drink', zh_CN: '食物与食品', ru_RU: 'Еда & Напитки' },
        items:
          '🥬 🥦 🧄 🧅 🍄 🥜 🫘 🌰 🍞 🥐 🥖 🫓 🥨 🥯 🥞 🧇 🧀 🍖 🍗 🥩 🥓 🍔 🍟 🍕 🌭 🥪 🌮 🌯 🫔 🥙 🧆 🥚 🍳 🥘 🍲 🫕 🥣 🥗 🍿 🧈 🧂 🥫 🍱 🍘 🍙 🍚 🍛 🍜 🍝 🍠 🍢 🍣 🍤 🍥 🥮 🍡 🥟 🥠 🥡 🦀 🦞 🦐 🦑 🦪 🍦 🍧 🍨 🍩 🍪 🎂 🍰 🧁 🥧 🍫 🍬 🍭 🍮 🍯 🍼 🥛 ☕ 🫖 🍵 🍶 🍾 🍷 🍸 🍹 🍺 🍻 🥂 🥃 🫗 🥤 🧋 🧃 🧉 🧊 🥢 🍽️ 🍴 🥄 🔪 🫙 🏺',
      },
      {
        label: { en_US: 'Activities', zh_CN: '活动', ru_RU: 'Активность' },
        items:
          '🎗️ 🎟️ 🎫 🎖️ 🏆 🏅 🥇 🥈 🥉 ⚽ ⚾ 🥎 🏀 🏐 🏈 🏉 🎾 🥏 🎳 🏏 🏑 🏒 🥍 🏓 🏸 🥊 🥋 🥅 ⛳ ⛸️ 🎣 🤿 🎽 🎿 🛷 🥌 🎯 🪀 🪁 🎱 🔮 🪄 🧿 🪬 🎮 🕹️ 🎰 🎲 🧩 🧸 🪅 🪩 🪆 ♠️ ♥️ ♦️ ♣️ ♟️ 🃏 🀄 🎴 🎭 🖼️ 🎨 🧵 🪡 🧶 🪢',
      },
      {
        label: { en_US: 'Travel & Places', zh_CN: '旅行与景点', ru_RU: 'Путешествия & Места' },
        items:
          '🚈 🚉 🚊 🚝 🚞 🚋 🚌 🚍 🚎 🚐 🚑 🚒 🚓 🚔 🚕 🚖 🚗 🚘 🚙 🛻 🚚 🚛 🚜 🏎️ 🏍️ 🛵 🦽 🦼 🛺 🚲 🛴 🛹 🛼 🚏 🛣️ 🛤️ 🛢️ ⛽ 🛞 🚨 🚥 🚦 🛑 🚧 ⚓ 🛟 ⛵ 🛶 🚤 🛳️ ⛴️ 🛥️ 🚢 ✈️ 🛩️ 🛫 🛬 🪂 💺 🚁 🚟 🚠 🚡 🛰️ 🚀 🛸 🛎️ 🧳 ⌛ ⏳ ⌚ ⏰ ⏱️ ⏲️ 🕰️ 🕛 🕧 🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘 🌙 🌚 🌛 🌜 🌡️ ☀️ 🌝 🌞 🪐 ⭐ 🌟 🌠 🌌 ☁️ ⛅ ⛈️ 🌤️ 🌥️ 🌦️ 🌧️ 🌨️ 🌩️ 🌪️ 🌫️ 🌬️ 🌀 🌈 🌂 ☂️ ☔ ⛱️ ⚡ ❄️ ☃️ ⛄ ☄️ 🔥 💧 🌊',
      },
      {
        label: { en_US: 'Objects', zh_CN: '物品', ru_RU: 'Объекты' },
        items:
          '📃 📜 📄 📰 🗞️ 📑 🔖 🏷️ 💰 🪙 💴 💵 💶 💷 💸 💳 🧾 💹 ✉️ 📧 📨 📩 📤 📥 📦 📫 📪 📬 📭 📮 🗳️ ✏️ ✒️ 🖋️ 🖊️ 🖌️ 🖍️ 📝 💼 📁 📂 🗂️ 📅 📆 🗒️ 🗓️ 📇 📈 📉 📊 📋 📌 📍 📎 🖇️ 📏 📐 ✂️ 🗃️ 🗄️ 🗑️ 🔒 🔓 🔏 🔐 🔑 🗝️ 🔨 🪓 ⛏️ ⚒️ 🛠️ 🗡️ ⚔️ 🔫 🪃 🏹 🛡️ 🪚 🔧 🪛 🔩 ⚙️ 🗜️ ⚖️ 🦯 🔗 ⛓️ 🪝 🧰 🧲 🪜 ⚗️ 🧪 🧫 🧬 🔬 🔭 📡 💉 🩸 💊 🩹 🩼 🩺 🩻 🚪 🛗 🪞 🪟 🛏️ 🛋️ 🪑 🚽 🪠 🚿 🛁 🪤 🪒 🧴 🧷 🧹 🧺 🧻 🪣 🧼 🫧 🪥 🧽 🧯 🛒 🚬 ⚰️ 🪦 ⚱️ 🗿 🪧 🪪',
      },
      {
        label: { en_US: 'Symbols', zh_CN: '符号', ru_RU: 'Символы' },
        items:
          '➰ ➿ 〽️ ✳️ ✴️ ❇️ ©️ ®️ ™️ #️⃣ *️⃣ 0️⃣ 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ 🔟 🔠 🔡 🔢 🔣 🔤 🅰️ 🆎 🅱️ 🆑 🆒 🆓 ℹ️ 🆔 Ⓜ️ 🆕 🆖 🅾️ 🆗 🅿️ 🆘 🆙 🆚 🈁 🈂️ 🔴 🟠 🟡 🟢 🔵 🟣 🟤 ⚫ ⚪ 🟥 🟧 🟨 🟩 🟦 🟪 🟫 ⬛ ⬜ ◼️ ◻️ ◾ ◽ ▪️ ▫️ 🔶 🔷 🔸 🔹 🔺 🔻 💠 🔘 🔳 🔲',
      },
      {
        label: { en_US: 'Flags', zh_CN: '旗帜', ru_RU: 'Флаги' },
        items:
          '🏁 🇨🇳 🎌 🇩🇪 🇪🇸 🇦🇨 🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬 🇧🇭 🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾 🇧🇿 🇨🇦 🇨🇨 🇨🇩 🇨🇫 🇨🇬 🇨🇭 🇨🇮 🇨🇰 🇨🇱 🇨🇲 🇨🇴 🇨🇵 🇨🇷 🇨🇺 🇨🇻 🇨🇼 🇨🇽 🇨🇾 🇨🇿 🇩🇬 🇩🇯 🇩🇰 🇩🇲 🇩🇴 🇩🇿 🇪🇦 🇪🇨 🇪🇪 🇪🇬 🇪🇭 🏴󠁧󠁢󠁥󠁮󠁧󠁿 🇪🇷 🇪🇹 🇪🇺 🇫🇮 🇫🇯 🇫🇰 🇫🇲 🇫🇴 🇬🇦 🇬🇩 🇬🇪 🇬🇫 🇬🇬 🇬🇭 🇬🇮 🇬🇱 🇬🇲 🇬🇳 🇬🇵 🇬🇶 🇬🇷 🇬🇸 🇬🇹 🇬🇺 🇬🇼 🇬🇾 🇭🇰 🇭🇲 🇭🇳 🇭🇷 🇭🇹 🇭🇺 🇮🇨 🇮🇩 🇮🇪 🇮🇱 🇮🇲 🇮🇳 🇮🇴 🇮🇶 🇮🇷 🇮🇸 🇯🇪 🇯🇲 🇯🇴 🇰🇪 🇰🇬 🇰🇭 🇰🇮 🇰🇲 🇰🇳 🇰🇵 🇰🇼 🇰🇾 🇰🇿 🇱🇦 🇱🇧 🇱🇨 🇱🇮 🇱🇰 🇱🇷 🇱🇸 🇱🇹 🇱🇺 🇱🇻 🇱🇾 🇲🇦 🇲🇨 🇲🇩 🇲🇪 🇲🇫 🇲🇬 🇲🇭 🇲🇰 🇲🇱 🇲🇲 🇲🇳 🇲🇴 🇲🇵 🇲🇶 🇲🇷 🇲🇸 🇲🇹 🇲🇺 🇲🇻 🇲🇼 🇲🇽 🇲🇾 🇲🇿 🇳🇦 🇳🇨 🇳🇪 🇳🇫 🇳🇬 🇳🇮 🇳🇱 🇳🇴',
      },
    ],
    pageSizes: [
      { label: 'A4', width: 21.0, height: 29.7, default: true },
      { label: 'A3', width: 29.7, height: 42.0 },
      { label: 'A5', width: 14.8, height: 21.0 },
      { label: 'B5', width: 17.6, height: 25.0 },
      {
        label: { en_US: 'No. 5 Envelope', zh_CN: '5号信封', ru_RU: 'Конверт №5' },
        width: 10.9,
        height: 12.9,
      },
      {
        label: { en_US: 'No. 6 Envelope', zh_CN: '6号信封', ru_RU: 'Конверт №6' },
        width: 11.9,
        height: 22.9,
      },
      {
        label: { en_US: 'No. 7 Envelope', zh_CN: '7号信封', ru_RU: 'Конверт №7' },
        width: 16.1,
        height: 22.8,
      },
      {
        label: { en_US: 'No. 9 Envelope', zh_CN: '9号信封', ru_RU: 'Конверт №9' },
        width: 22.8,
        height: 32.3,
      },
      {
        label: { en_US: 'Legal Paper', zh_CN: '法律用纸', ru_RU: 'Юридическая бумага' },
        width: 21.5,
        height: 33.5,
      },
      {
        label: { en_US: 'Letter Paper', zh_CN: '信纸', ru_RU: 'Бумага для писем' },
        width: 21.5,
        height: 27.9,
      },
    ],
  },
  toolbar: {
    defaultMode: 'ribbon',
    enableSourceEditor: false,
    menus: ['base', 'insert', 'table', 'tools', 'page', 'export'],
    disableMenuItems: [],
    importWord: {
      enabled: true,
      options: {},
      useCustomMethod: false,
    },
  },
  page: {
    defaultMargin: {
      left: 3.18,
      right: 3.18,
      top: 2.54,
      bottom: 2.54,
    },
    defaultOrientation: 'portrait',
    defaultBackground: '#fff',
    watermark: {
      type: 'compact',
      alpha: 0.2,
      fontColor: '#000',
      fontSize: 16,
      fontFamily: 'SimSun',
      fontWeight: 'normal',
      text: '',
    },
    /*
     * 新添加的 bolck 自定义节点如果需要参与分页,需要给 types 添加对应的类型 types:["myBlock"],
     * 如果是用 nodeView 实现的节点,需要自定义节点外层添加代码 :id="node.attrs.id",可以参考 image 扩展
     * 如果需要添加自定义计算方法,请在 nodesComputedOption 中添加
     * 例如新添加节点名字为 'myBlock'
     * nodesComputedOption:{
     *   types: ["myBlock"],
     *   nodesComputed: {
     *    'myBlock': (splitContex, node, pos, parent, dom) => {
     *      //分页计算代码
     *    }
     *  }
     * } 否则走默认的计算
     **/
    nodesComputedOption: {
      types: [],
      nodesComputed: {},
    },
  },
  document: {
    title: '',
    content: '',
    placeholder: {
      en_US: 'Please enter the document content...',
      zh_CN: '请输入文档内容...',
      ru_RU: 'Пожалуйста, введите содержимое документа...',
    },
    enableSpellcheck: true,
    enableMarkdown: true,
    enableBubbleMenu: true,
    enableBlockMenu: true,
    readOnly: false,
    autofocus: true,
    characterLimit: 0,
    typographyRules: {},
    // https://prosemirror.net/docs/ref/#view.EditorProps
    editorProps: {},
    // https://prosemirror.net/docs/ref/#model.ParseOptions
    parseOptions: {
      preserveWhitespace: 'full',
    },
    autoSave: {
      enabled: true,
      interval: 300000,
    },
  },
  assistant: {
    enabled: false,
    maxlength: 100,
    commands: [
      {
        label: { en_US: 'Continuation', zh_CN: '续写', ru_RU: 'Продолжение' },
        value: { en_US: 'Continuation', zh_CN: '续写', ru_RU: 'Продолжение' },
      },
      {
        label: { en_US: 'Rewrite', zh_CN: '重写', ru_RU: 'Переписать' },
        value: { en_US: 'Rewrite', zh_CN: '重写', ru_RU: 'Переписать' },
      },
      {
        label: { en_US: 'Abbreviation', zh_CN: '缩写', ru_RU: 'Аббревиатура' },
        value: { en_US: 'Abbreviation', zh_CN: '缩写', ru_RU: 'Аббревиатура' },
      },
      {
        label: { en_US: 'Expansion', zh_CN: '扩写', ru_RU: 'Расширение' },
        value: { en_US: 'Expansion', zh_CN: '扩写', ru_RU: 'Расширение' },
      },
      {
        label: { en_US: 'Polish', zh_CN: '润色', ru_RU: 'Польский' },
        value: { en_US: 'Polish', zh_CN: '润色', ru_RU: 'Польский' },
      },
      {
        label: { en_US: 'Proofread', zh_CN: '校阅', ru_RU: 'Корректура' },
        value: { en_US: 'Proofread', zh_CN: '校阅', ru_RU: 'Корректура' },
      },
      {
        label: { en_US: 'Translate', zh_CN: '翻译', ru_RU: 'Перевести' },
        value: { en_US: 'Translate to chinese', zh_CN: '翻译成英文', ru_RU: 'Перевести на китайский' },
        autoSend: false,
      },
    ],
  },
  templates: [],
  cdnUrl: 'https://unpkg.com/@umoteam/editor-external@4',
  shareUrl: location.href || '',
  diagrams: {
    domain: 'https://embed.diagrams.net',
    // https://www.drawio.com/doc/faq/supported-url-parameters
    params: {},
  },
  file: {
    allowedMimeTypes: [],
    maxSize: 1024 * 1024 * 100, // 100M
  },
  user: {},
  extensions: [],
  translations: {
    en_US: {},
    zh_CN: {},
    ru_RU: {},
  },
  async onSave() {
    return await new Promise((_, reject) => {
      reject(new Error('Key "onSave": Please set the save method'))
    })
  },
  async onFileUpload(file: File) {
    return await new Promise((_, reject) => {
      if (!file) {
        reject(new Error('File not found'))
        return
      }
      reject(new Error('Key "onFileUpload": Please set the upload method'))
    })
  },
  onFileDelete() {
    console.error(
      'The file has been deleted. Please configure the onFileDelete to completely delete the file from the server.',
    )
  },
  async onAssistant() {
    return await new Promise((_, reject) => {
      reject(new Error('Key "onAssistant": Please set the onAssistant method'))
    })
  },
  async onCustomImportWordMethod() {
    return await new Promise((_, reject) => {
      reject(
        new Error(
          'Key "onCustomImportWordMethod": Please set the onAssistant method',
        ),
      )
    })
  },
}
🚫

自 v2.0.0 版本开始,dicts 中的 labeldocument.placeholder 等项支持 StringObject 两种类型,Object 类型用主要用于配置多语言信息,格式为 { en_US: 'English', zh_CN: '中文说明' }

区域划分

配置说明

Umo Editor 的配置项主要分为以下几部分:

  • editorKey:String,编辑器Key,用于区分不同的编辑器实例。
  • locale:String,显示语言,默认为中文。v2.0.0 新增
  • theme:String,主题设置,默认为浅色主题。v2.1.0 新增
  • height:String,编辑器高度。
  • dicts:Object,字典配置,详见字典配置
  • toolbar:Object,工具栏配置,详见工具栏配置
  • page:Object,页面配置,详见页面配置
  • document:Object,文档配置,详见文档配置
  • assistant:Object,AI 文档助手配置,详见AI 文档助手v3.0.0 新增
  • templates:Array,预置的页面模板配置,详见模板配置
  • cdnUrl:String,静态资源的基础路径,需为合法的 URL,详见CDN配置
  • shareUrl:String,分享链接配置,需为合法的 URL,详见分享配置
  • diagrams:Object,Diagrams 图表配置,详见Diagrams 图表配置
  • file:Object,文件上传配置,详见文件上传配置
  • extensions:Array 详见自定义插件v1.4.0 新增
  • translations:Object 详见自定义翻译信息v2.0.0 新增
  • onSave(content, page, document):Async Function,文档保存方法,应返回 Promise,详见方法配置
  • onFileUpload(file):Async Function,Async Function,文件上传方法,应返回 Promise,详见方法配置
  • onFileDelete(id, url):Function,文件删除方法,详见方法配置
  • onAssistant(payload, content):Async Function,AI 文档助手返回数据方法,详见AI 助手配置v3.0.0 新增
  • onCustomImportWordMethod(file):Async Function,自定义 Word 文件导入方法,详见方法配置置v3.1.0 新增