Document Import
This feature allows you to import Umo Editor proprietary document formats, Office and WPS documents (including: doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc.), Markdown, and plain text documents into the Umo Editor.
Demo Video
Configuration Example
const defaultOptions = {
// Document import related configuration
import: {
office: {
limitSize: 50, // 50 MB
},
text: {
replaceEmptyLines: false,
},
},
}Configuration Details
import.office
Description: Configuration for importing Office documents, supports importing Office and WPS documents in formats such as doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc. You can also extend supported formats.
Type: Object
Default:
{
limitSize: 50, // 50 MB
}Configuration Items:
limitSize: Maximum file size allowed for import, default is 50 MB.
import.markdown
Description: Configuration for importing Markdown documents. Removed in v10
This configuration was removed in v10.0. Please refer to Markdown Enhancements for the new Markdown support mechanism.
Type: Object
Default: {}
Configuration Items:
enabled: Enable importing Markdown files, default istrue.options: Configuration for MarkdownIt, see: https://markdown-it.github.io/markdown-it/#MarkdownIt.new .
import.text
Description: Configuration for importing text documents, used to configure text document import functionality.
Type: Object
Default: {}
Configuration Items:
replaceEmptyLines: Whether to replace empty lines in the document, default isfalse.
Methods
importDocument
Description: Import Umo Editor documents, supports .umo format exported by Umo Editor.
Parameters:
file:File, the.umodocument exported by Umo Editor.
Returns: Boolean, whether the import was successful.
importOffice
Description: Import Office documents, supports formats such as doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc.
Parameters:
file:File, the Office document file.
Returns: Boolean, whether the import was successful.
importMarkdown
Description: Import Markdown document content. Removed in v10
This configuration was removed in v10.0. Please refer to Markdown Enhancements for the new Markdown support mechanism.
Parameters:
object: Object, MarkdownIt configuration, see: https://markdown-it.github.io/markdown-it/#MarkdownIt.new , default uses import.markdown.options.
Returns: Boolean, whether the import was successful.
importText
Description: Import plain text content.
Parameters:
text:String, the text content.replaceEmptyLines:Boolean, whether to replace empty lines, default usesimport.text.replaceEmptyLines.
Returns: Boolean, whether the import was successful.