mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-22 22:59:58 +08:00
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:
@ -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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user