mirror of
https://github.com/penpot/penpot.git
synced 2025-07-25 23:47:23 +02:00
✨ Add minor improvements to text editor v2 events handling
Also updates the editor code to the latest version
This commit is contained in:
parent
352efcb610
commit
ffadf29ad7
5 changed files with 175 additions and 129 deletions
46
frontend/vendor/text_editor_v2.js
vendored
46
frontend/vendor/text_editor_v2.js
vendored
|
@ -2740,5 +2740,49 @@ notifyLayout_fn = function(type = LayoutType.FULL, mutations) {
|
|||
})
|
||||
);
|
||||
};
|
||||
export default TextEditor;
|
||||
function isEditor(instance) {
|
||||
return instance instanceof TextEditor;
|
||||
}
|
||||
function getRoot(instance) {
|
||||
if (isEditor(instance)) {
|
||||
return instance.root;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function setRoot(instance, root) {
|
||||
if (isEditor(instance)) {
|
||||
instance.root = root;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
function create(element, options) {
|
||||
return new TextEditor(element, { ...options });
|
||||
}
|
||||
function getCurrentStyle(instance) {
|
||||
if (isEditor(instance)) {
|
||||
return instance.currentStyle;
|
||||
}
|
||||
}
|
||||
function applyStylesToSelection(instance, styles) {
|
||||
if (isEditor(instance)) {
|
||||
return instance.applyStylesToSelection(styles);
|
||||
}
|
||||
}
|
||||
function dispose(instance) {
|
||||
if (isEditor(instance)) {
|
||||
instance.dispose();
|
||||
}
|
||||
}
|
||||
export {
|
||||
TextEditor,
|
||||
applyStylesToSelection,
|
||||
create,
|
||||
TextEditor as default,
|
||||
dispose,
|
||||
getCurrentStyle,
|
||||
getRoot,
|
||||
isEditor,
|
||||
setRoot
|
||||
};
|
||||
//# sourceMappingURL=TextEditor.js.map
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue