Skip to content

Introduce onLoadContent extensions API #105

@mkhatib

Description

@mkhatib

This would allow extensions to parse content loaded into the editor in any format (HTML, Objects, Markdown...) and execute operations against the editor to insert the content into the model.

core/abstract-extension.js

/**
 * @param {*} content
 * @param {Selection} opt_insertAtCursor
 * @return {boolean}
 */
AbstractExtension.prototype.onLoadContent = function(content, opt_insertAt) {};

editor.js

/**
 * Allows loading content in any format. This would pass the content to
 * installed extensions.onLoadContent callback to allow them to process it and
 * load it.
 * @param {*} content Content to load into the editor.
 * @param {boolean=} opt_override Whether to override the content of editor.
 * @param {string=} opt_loaderName The loader name if known.
 */
Editor.prototype.loadContent = function(content, opt_overrideCurrentContent, opt_loaderName) {}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions