Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce onLoadContent extensions API #105

Open
mkhatib opened this issue Dec 29, 2016 · 0 comments
Open

Introduce onLoadContent extensions API #105

mkhatib opened this issue Dec 29, 2016 · 0 comments

Comments

@mkhatib
Copy link
Member

mkhatib commented Dec 29, 2016

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) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant