mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-16 02:06:08 +01:00
Refresh the editors if necessary and when switching tab to ensure visibility of its content
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import Cookies from 'cookies-js';
|
import Cookies from 'cookies-js';
|
||||||
|
import { Instance as Editors } from '../forms/fields/editor';
|
||||||
|
|
||||||
let Data = JSON.parse(Cookies.get('grav-tabs-state') || '{}');
|
let Data = JSON.parse(Cookies.get('grav-tabs-state') || '{}');
|
||||||
|
|
||||||
@@ -9,4 +10,12 @@ $('body').on('touchstart click', '[name^="tab-"]', (event) => {
|
|||||||
|
|
||||||
Data[target.attr('name')] = target.val();
|
Data[target.attr('name')] = target.val();
|
||||||
Cookies.set('grav-tabs-state', JSON.stringify(Data), { expires: Infinity });
|
Cookies.set('grav-tabs-state', JSON.stringify(Data), { expires: Infinity });
|
||||||
|
|
||||||
|
Editors.editors.each((index, editor) => {
|
||||||
|
let codemirror = $(editor).data('codemirror');
|
||||||
|
if (!codemirror) { return; }
|
||||||
|
if (codemirror.display.lastWrapWidth === 0) {
|
||||||
|
codemirror.refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
4
themes/grav/js/admin.min.js
vendored
4
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user