Commit 92c9a50b authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'sse-uneditable-block-ux' into 'master'

Uneditable block spacing and minor listener refactor

See merge request gitlab-org/gitlab!37087
parents b9fe00ab aa431289
...@@ -73,6 +73,15 @@ export default { ...@@ -73,6 +73,15 @@ export default {
}, },
}, },
beforeDestroy() { beforeDestroy() {
this.removeListeners();
},
methods: {
addListeners(editorApi) {
addCustomEventListener(editorApi, CUSTOM_EVENTS.openAddImageModal, this.onOpenAddImageModal);
editorApi.eventManager.listen('changeMode', this.onChangeMode);
},
removeListeners() {
removeCustomEventListener( removeCustomEventListener(
this.editorApi, this.editorApi,
CUSTOM_EVENTS.openAddImageModal, CUSTOM_EVENTS.openAddImageModal,
...@@ -81,7 +90,6 @@ export default { ...@@ -81,7 +90,6 @@ export default {
this.editorApi.eventManager.removeEventHandler('changeMode', this.onChangeMode); this.editorApi.eventManager.removeEventHandler('changeMode', this.onChangeMode);
}, },
methods: {
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