@nextgensoftwares/folio-plugin-import
Import UI and applying imports to an editor. Guide: Import. @nextgensoftwares/folio-plugin-import/apply has the non-React part only.
Plugin
| Export | Description |
|---|---|
importPlugin(options) | toolbar items import.open ("Open file…") and import.insert ("Import…") in group file, the overlay dialog, the drop hook |
type ImportPluginOptions | importers, openDocument?(prepared, { name, result }), applyOptions?(editor), attach?(editor, files, at), drop?, limits?, importOptions?, schema? (e.g. docxImportSchema), toolbar?, onImported? |
type ImportPlugin | FolioPlugin plus controller, pick(editor, mode), importFile(editor, file, mode) |
ImportController | the flow as a store: state, busy, subscribe, run(editor, file, mode), ask(editor, files, at), choose('open' | 'insert' | 'attach'), cancel(), dismiss() |
type ImportState, type ImportPhase, type ImportMode | idle, choose, reading, converting, applying, done, error, cancelled; mode open | insert |
createImportOverlay(controller) | the dialog component (for hosts rendering their own overlay) |
importable(file, importers), filesFrom(dataTransfer), pickFile(accept), type DropPoint | helpers |
Applying
| Export | Description |
|---|---|
applyImport(editor, result, options) | stores assets, fits to the schema, replaces or inserts as one undo step (progressive), applies theme, comments, meta |
type ApplyImportOptions | mode, theme?, setTheme?, upload?, comments? ({ store, actor } or a callback), setMeta?, applyPage?, adoptTheme?, adoptFonts?, adoptTextSize?, signal?, onProgress?, batchMs? |
type ApplyImportReport | warnings, meta, blocks |
prepareImport(result, options), type PrepareOptions, type PreparedImport | the same without an editor: doc, theme, comments, meta, warnings |
mergedTheme(result, theme, options?) | the host theme with the import's page setup and hints |
storeAssets(content, assets, options) | upload (or inline) assets and rewrite refs |
importComments(threads, store, actor) | creates threads, replies and resolution in a comment store |
type CommentStoreLike, type CommentActorLike, type CommentOpLike, type CommentAnchorLike | structural types matching @nextgensoftwares/folio-plugin-comments |
assetUploaderFrom(uploader), type MediaUploaderLike | plugin-media uploaders as an AssetUploader |