Updated codeblock editor to work with fade animation

- Added fadeIn to animation JS service.
- Updated overlay to use anim service and to recieve a callback for
after-anim actions.
- Updated code editor popup to refresh Codemirror instance layout after
animation has completed.

Fixes #1672
This commit is contained in:
Dan Brown
2019-12-07 16:54:34 +00:00
parent a6bbe46987
commit 5a533fff8b
4 changed files with 37 additions and 23 deletions

View File

@ -258,10 +258,18 @@ function setMode(cmInstance, modeSuggestion, content) {
function setContent(cmInstance, codeContent) {
cmInstance.setValue(codeContent);
setTimeout(() => {
cmInstance.refresh();
updateLayout(cmInstance);
}, 10);
}
/**
* Update the layout (codemirror refresh) of a cm instance.
* @param cmInstance
*/
function updateLayout(cmInstance) {
cmInstance.refresh();
}
/**
* Get a CodeMirror instance to use for the markdown editor.
* @param {HTMLElement} elem
@ -301,6 +309,7 @@ export default {
popupEditor: popupEditor,
setMode: setMode,
setContent: setContent,
updateLayout: updateLayout,
markdownEditor: markdownEditor,
getMetaKey: getMetaKey,
};