Commit aa431289 authored by derek-knox's avatar derek-knox

Uneditable block spacing and minor listener refactor

parent f724bf57
...@@ -73,15 +73,23 @@ export default { ...@@ -73,15 +73,23 @@ export default {
}, },
}, },
beforeDestroy() { beforeDestroy() {
removeCustomEventListener( this.removeListeners();
this.editorApi,
CUSTOM_EVENTS.openAddImageModal,
this.onOpenAddImageModal,
);
this.editorApi.eventManager.removeEventHandler('changeMode', this.onChangeMode);
}, },
methods: { methods: {
addListeners(editorApi) {
addCustomEventListener(editorApi, CUSTOM_EVENTS.openAddImageModal, this.onOpenAddImageModal);
editorApi.eventManager.listen('changeMode', this.onChangeMode);
},
removeListeners() {
removeCustomEventListener(
this.editorApi,
CUSTOM_EVENTS.openAddImageModal,
this.onOpenAddImageModal,
);
this.editorApi.eventManager.removeEventHandler('changeMode', this.onChangeMode);
},
resetInitialValue(newVal) { resetInitialValue(newVal) {
this.editorInstance.invoke('setMarkdown', newVal); this.editorInstance.invoke('setMarkdown', newVal);
}, },
...@@ -92,13 +100,8 @@ export default { ...@@ -92,13 +100,8 @@ export default {
this.editorApi = editorApi; this.editorApi = editorApi;
registerHTMLToMarkdownRenderer(editorApi); registerHTMLToMarkdownRenderer(editorApi);
addCustomEventListener(
this.editorApi,
CUSTOM_EVENTS.openAddImageModal,
this.onOpenAddImageModal,
);
this.editorApi.eventManager.listen('changeMode', this.onChangeMode); this.addListeners(editorApi);
}, },
onOpenAddImageModal() { onOpenAddImageModal() {
this.$refs.addImageModal.show(); this.$refs.addImageModal.show();
......
...@@ -13,7 +13,7 @@ const buildUneditableOpenToken = (tagType = TAG_TYPES.block) => ...@@ -13,7 +13,7 @@ const buildUneditableOpenToken = (tagType = TAG_TYPES.block) =>
buildToken('openTag', tagType, { buildToken('openTag', tagType, {
attributes: { contenteditable: false }, attributes: { contenteditable: false },
classNames: [ classNames: [
'gl-px-4 gl-py-2 gl-opacity-5 gl-bg-gray-100 gl-user-select-none gl-cursor-not-allowed', 'gl-px-4 gl-py-2 gl-my-5 gl-opacity-5 gl-bg-gray-100 gl-user-select-none gl-cursor-not-allowed',
], ],
}); });
......
...@@ -18,7 +18,7 @@ const buildMockUneditableOpenToken = type => { ...@@ -18,7 +18,7 @@ const buildMockUneditableOpenToken = type => {
tagName: type, tagName: type,
attributes: { contenteditable: false }, attributes: { contenteditable: false },
classNames: [ classNames: [
'gl-px-4 gl-py-2 gl-opacity-5 gl-bg-gray-100 gl-user-select-none gl-cursor-not-allowed', 'gl-px-4 gl-py-2 gl-my-5 gl-opacity-5 gl-bg-gray-100 gl-user-select-none gl-cursor-not-allowed',
], ],
}; };
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment