开发文档配置项默认配置

默认配置

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

所有配置

const defaultOptions = {
  editorKey: 'default',
  locale: 'zh-CN',
  theme: 'light',
  height: '100%',
  fullscreenZIndex: 10,
  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:
          '💡 ✅ ☑️ ✔️ ❌ ❎ ❓ ❗ ❔ ❕ ⌛ ⏳ 💰 🆒 🆕 🆖 🅾️ 🆗 🆘 🈲 🉑 🈸 ⛔ 🚫 📵 ✳️ ✴️ ❇️ 🔟 🔠 🔡 🔢 🔣 🔤 🅰️ 🆎 🅱️ 🆑 🆒 🆓 ℹ️ 🆔 🆕 🆖 🅾️ 🆗 🅿️ 🆘 🆙 🆚 🈁 🈂️ 🔴 🟠 🟡 🟢 🔵 🟣 🟤 ⚫ ⚪ 🟥 🟧 🟨 🟩 🟦 🟪 🟫 🔶 🔷 🔸 🔹 🔺 🔻 💠 🔘 🔳 🔲 💌 💘 💝 💖 💗 💓 💞 💕 💟 ❣️ 💔 🤍 💯 💢 💥 💬 💤 ➰ ➿ 🔅 📴 ➡️ 🔃 🔄 🔙 🔚 🔛 🔝 🔀 🔁 🔂',
      },
      {
        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',
    menus: ['base', 'insert', 'table', 'tools', 'page', 'export'],
    disableMenuItems: [],
    importWord: {
      enabled: true,
      options: {},
      useCustomMethod: false,
      // v6.0.0 调整
      async onCustomImportMethod() { 
      },
    },
  },
  page: {
    defaultMargin: {
      left: 3.18,
      right: 3.18,
      top: 2.54,
      bottom: 2.54,
    },
    defaultOrientation: 'portrait',
    defaultBackground: '#fff',
    showBreakMarks: true,
    showBookmark: false,
    showLineNumber: false,
    showToc: false,
    watermark: {
      type: 'compact',
      alpha: 0.2,
      fontColor: '#000',
      fontSize: 16,
      fontFamily: 'SimSun',
      fontWeight: 'normal',
      text: '',
    },
  },
  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,
    },
  },
  ai:{
    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,
        },
      ],
      async onMessage() {},
  },
  echarts: {
    mode: 1, 
    renderImage: false,
    onCustomSettings() {
      return null
    },
  },
  webPages: [
    {
      label: {
        zh_CN: '哔哩哔哩',
        en_US: 'Bilibili',
        ru_RU: 'Bilibili',
      },
      icon: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.39 3.714h.5c.88.032 1.614.337 2.2.918.586.58.889 1.312.91 2.194v4.293c-.021.88-.324 1.615-.91 2.201-.586.586-1.32.889-2.2.91H4.11c-.88-.021-1.614-.324-2.2-.91-.586-.586-.889-1.32-.91-2.2V6.825c.021-.882.324-1.613.91-2.194.586-.58 1.32-.886 2.2-.918h.452l-.684-.653a.72.72 0 0 1-.218-.529.72.72 0 0 1 .218-.529l.015-.015a.763.763 0 0 1 .537-.218c.202 0 .38.072.537.218L6.63 3.59c.041.041.078.083.109.124h2.49a.487.487 0 0 1 .092-.124l1.665-1.602a.763.763 0 0 1 .536-.218c.203 0 .386.088.542.233a.691.691 0 0 1 .228.53.72.72 0 0 1-.217.528l-.685.653zm-7.28 1.51c-.434.01-.8.16-1.096.45-.295.29-.448.66-.458 1.105v4.387c.01.445.163.813.458 1.104.296.29.662.441 1.097.45h7.778c.435-.009.801-.16 1.097-.45.295-.29.448-.659.458-1.104V6.779c-.01-.446-.163-.814-.458-1.105a1.563 1.563 0 0 0-1.097-.45H4.111zm1.557 2.255c.217 0 .399.072.544.218a.809.809 0 0 1 .233.56v.684a.809.809 0 0 1-.233.56.736.736 0 0 1-.544.218.739.739 0 0 1-.545-.218.809.809 0 0 1-.233-.56v-.684c0-.218.075-.402.225-.553a.753.753 0 0 1 .553-.225zm4.666 0c.218 0 .4.072.545.218a.809.809 0 0 1 .233.56v.684a.809.809 0 0 1-.233.56.737.737 0 0 1-.545.218.739.739 0 0 1-.544-.218.809.809 0 0 1-.233-.56v-.684a.809.809 0 0 1 .233-.56.738.738 0 0 1 .544-.218z" fill="#07A3D7"/></svg>',
      validate(url: string) {
        const pattern = /^https?:\/\/(www\.)?bilibili\.com\/video\/[a-zA-Z0-9]+/
        return pattern.test(url)
      },
      transformURL(url: string) {
        const videoId = url.match(/\/video\/([a-zA-Z0-9]+)/)?.[1]
        return videoId
          ? `https://player.bilibili.com/player.html?bvid=${videoId}`
          : ''
      },
    },
    {
      label: {
        zh_CN: '优酷',
        en_US: 'Youku',
        ru_RU: 'Youku',
      },
      icon: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M270.528 902.592c-82.688-45.952-104.576-161.984-43.072-232 26.688-30.208 214.592-142.784 229.632-137.344 17.088 5.504 7.488-.64-112.768-71.36-105.92-62.464-129.152-83.776-144.896-129.792-34.816-105.664 58.112-218.944 166.08-202.496 24.576 4.096 102.528 42.56 175.616 87.168 13.696 8.32 70.4 41.216 125.76 73.472 119.616 69.376 153.792 97.472 178.368 148.288 20.48 41.856 24.576 100.928 10.24 151.68-8.896 32.32-41.664 78.976-71.04 100.992l-19.2 14.4-33.408-19.2c-19.2-11.008-34.176-17.92-34.176-15.808 0 1.344 12.288 10.24 27.328 18.56 15.04 8.896 27.328 17.152 27.328 19.2 0 4.8-281.6 168.832-334.208 194.24-51.904 26.112-100.48 26.112-147.584 0z" fill="#018EFF"/><path d="M665.984 654.4c0-1.088-6.912-5.888-15.936-10.624-20.16-10.112-21.248-5.888-1.088 4.736 16.512 9.024 17.024 9.6 17.024 5.888zm-50.56 5.952c-8.448-7.424-55.744-33.408-55.744-30.72 0 2.56 53.632 35.008 58.432 35.52 1.024 0 0-2.112-2.688-4.8z" fill="#018EFF"/><path d="M673.472 653.44a4171.008 4171.008 0 0 0-126.336-72.768c-43.712-24.064-92.224-52.864-233.6-137.344C238.4 398.72 213.76 374.016 199.424 332.16c-34.816-105.664 58.048-218.944 166.016-202.496 24.576 4.096 102.4 42.56 175.552 87.168 13.632 8.32 70.336 41.216 125.632 73.472 114.112 65.92 146.88 92.032 170.752 133.184 47.872 81.728 29.44 195.008-40.96 257.472-13.632 11.648-27.968 21.248-32.768 21.248-4.8-.64-45.12-21.952-90.176-48.704z" fill="#FF396E"/><path d="M270.464 902.592A152.32 152.32 0 0 1 193.28 781.76c-6.144-76.8 21.184-115.328 130.496-179.84l75.136-44.608L568.96 630.08c93.568 39.808 172.8 72.064 176.256 72.064 4.096 0 6.784 2.048 6.784 5.504 0 5.504-273.216 165.44-334.016 194.944-51.84 26.112-100.352 26.112-147.52 0z" fill="#00BEFF"/></svg>',
      validate(url: string) {
        const pattern = /^https?:\/\/v\.youku\.com\/v_show\/id_[a-zA-Z0-9]+/
        return pattern.test(url)
      },
      transformURL(url: string) {
        const videoId = url.match(/\/id_([a-zA-Z0-9]+)/)?.[1]
        return videoId ? `https://player.youku.com/embed/${videoId}` : ''
      },
    },
    {
      label: {
        zh_CN: 'Figma',
        en_US: 'Figma',
        ru_RU: 'Figma',
      },
      icon: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.324 8c0-1.475 1.2-2.675 2.675-2.675 1.475 0 2.675 1.2 2.675 2.675 0 1.475-1.2 2.675-2.675 2.675A2.678 2.678 0 0 1 8.324 8z" fill="#1ABCFE"/><path d="M3 13.325c0-1.475 1.2-2.675 2.675-2.675h2.65v2.675C8.325 14.8 7.125 16 5.65 16 4.175 16 3 14.8 3 13.325z" fill="#0ACF83"/><path d="M8.324 0v5.325H11c1.475 0 2.675-1.2 2.675-2.675C13.674 1.175 12.474 0 11 0H8.324z" fill="#FF7262"/><path d="M3 2.675C3 4.15 4.2 5.35 5.675 5.35h2.65V0H5.65C4.175 0 3 1.2 3 2.675z" fill="#F24E1E"/><path d="M3 8c0 1.475 1.2 2.675 2.675 2.675h2.65v-5.35H5.65C4.175 5.325 3 6.525 3 8z" fill="#A259FF"/></svg>',
      validate(url: string) {
        const pattern = /^https?:\/\/www\.figma\.com\/file\/[a-zA-Z0-9]+/
        return pattern.test(url)
      },
      transformURL(url: string) {
        const fileId = url.match(/\/file\/([a-zA-Z0-9]+)/)?.[1]
        return fileId
          ? `https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/${fileId}`
          : ''
      },
    },
    {
      label: {
        zh_CN: '墨刀',
        en_US: 'MockingBot',
        ru_RU: 'MockingBot',
      },
      icon: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 3h2.715v4.752H2V3zm6.958 0H6.242v4.752h2.716V3zm4.582 0h-2.716v4.752h2.716V3zM9.107 14l-1.096-2.5a3.905 3.905 0 0 0 2.812-3.748h2.716A6.621 6.621 0 0 1 9.107 14z" fill="#F33"/></svg>',
      validate(url: string) {
        const pattern = /^https?:\/\/modao\.cc\/app\/[a-zA-Z0-9]+/
        return pattern.test(url)
      },
      transformURL(url: string) {
        return url
      },
    },
    {
      label: {
        zh_CN: '腾讯视频',
        en_US: 'Tencent Video',
        ru_RU: 'Tencent Video',
      },
      icon: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.314 14.541c-1.416-.025-1.71-1.416-1.964-3.16-.155-1.06-.182-2.155-.182-3.23 0-1.074.027-2.169.182-3.23.31-2.14.685-3.75 3.123-2.95 2.336.768 4.586 2.126 6.56 3.67.1.085.209.177.324.272.705.59 1.62 1.355 1.642 2.239-.021.882-.936 1.647-1.641 2.237-.115.096-.225.187-.324.274-1.975 1.543-4.225 2.901-6.561 3.67-.418.136-.774.203-1.08.208h-.08z" fill="#4396F7"/><path d="M2.98 13.143c-1.202-.029-1.527-.954-1.755-2.162l-.02-.1-.036-.206C1.025 9.847 1 8.991 1 8.152c0-.84.025-1.694.17-2.523l.036-.205.019-.1c.267-1.418.668-2.447 2.464-2.094-.151.487-.247 1.067-.339 1.692-.154 1.061-.181 2.156-.181 3.23 0 1.074.027 2.169.181 3.23.092.624.188 1.204.34 1.692a3.501 3.501 0 0 1-.592.07H2.98z" fill="#EF8E34"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3.689 3.229c.125.025.256.055.395.094 2.181.6 4.28 1.66 6.124 2.866.66.483 1.812 1.16 1.834 1.962-.023.803-1.175 1.48-1.834 1.963-1.843 1.205-3.943 2.266-6.124 2.866-.139.038-.27.069-.395.094-.151-.488-.248-1.068-.338-1.693-.155-1.06-.182-2.156-.182-3.23 0-1.074.027-2.169.182-3.23.09-.62.185-1.197.335-1.683l.003-.009z" fill="#78E445"/><path d="M4.845 8.156c0-1.82.13-2.04.13-2.04.053-.234.18-.298.378-.241 0 0 .587.124 2.006.87 1.435.754 1.875 1.168 1.875 1.168.217.188.172.305 0 .483 0 0-.269.308-1.875 1.14-1.606.83-2.006.894-2.006.894-.239.056-.332-.015-.377-.24 0 0-.13-.21-.13-2.034z" fill="#fff"/></svg>',
      validate(url: string) {
        return url.startsWith('https://modao.cc/proto/')
      },
      transformURL(url: string) {
        const videoId = url.match(/\/cover\/[a-zA-Z0-9]+\/([a-zA-Z0-9]+)/)?.[1]
        return videoId ? `https://v.qq.com/iframe/player.html?vid=${videoId}` : ''
      },
    },
  ],
  templates: [],
  cdnUrl: 'https://unpkg.com/@umoteam/editor-external@latest',
  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
    preview: [
      { extensions: ['pdf'], url: '{url}' },
      {
        extensions: ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'],
        url: 'https://view.officeapps.live.com/op/embed.aspx?src={{url}}&amp;wdStartOn=1&amp;wdPrint=0&amp;wdEmbedCode=0',
      },
    ],
  },
  user: {},
  users: [],
  extensions: [],
  translations: {
    en_US: {},
    zh_CN: {},
    ru_RU: {},
  },
  async onSave() {},
  async onFileUpload(file: File) {},
  onFileDelete() {},
}
🚫

自 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,编辑器高度。
  • fullscreenZIndexNumber,全屏时容器的 z-index,用于防止被其他元素遮挡,例如在弹出层中使用。v6.0.0 新增
  • dicts:Object,字典配置,详见字典配置
  • toolbar:Object,工具栏配置,详见工具栏配置
  • page:Object,页面配置,详见页面配置
  • document:Object,文档配置,详见文档配置
  • ai:Object,AI 文档助手配置,详见AI 文档助手v3.0.0 新增
  • echarts:Object,ECharts 图表配置,详见ECharts 配置v6.0.0 新增
  • webPages:Object,Web 页面配置,详见Web 页面v6.0.0 新增
  • templates:Array,预置的页面模板配置,详见模板配置
  • cdnUrl:String,静态资源的基础路径,需为合法的 URL,详见CDN配置
  • shareUrl:String,分享链接配置,需为合法的 URL,详见分享配置
  • diagrams:Object,Diagrams 图表配置,详见Diagrams 图表配置
  • user:Object,当前用户配置,详见用户配置v4.0.0 新增
  • users:Array,相关用户配置,详见相关用户配置v6.0.0 新增
  • 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,文件删除方法,详见方法配置
最近修改于: 2025/04/23