Remove ProseMirror transaction logic because it is unnecessary

pull/1135/head
vtyeh 3 months ago
parent 08fd4be580
commit 3e9c122568
  1. 17
      templates/classic.tmpl

@ -348,27 +348,18 @@
} catch (e) {}
};
var fonts = document.querySelectorAll('nav#font-picker a.font');
var setFontClass = function(fontClass) {
return (state, dispatch) => {
if (dispatch && window.editorView) {
var setEditorFontClass = function(fontClass) {
if (window.editorView) {
window.editorView.view.dom.classList.remove("norm", "sans", "wrap");
window.editorView.view.dom.classList.add(fontClass);
}
return true;
}
}
var changeEditorFont = function(fontClass) {
if (window.editorView) {
const command = setFontClass(fontClass);
command(window.editorView.view.state, window.editorView.view.dispatch);
}
};
for (var i=0; i<fonts.length; i++) {
fonts[i].addEventListener('click', function(e) {
e.preventDefault();
selectedFont = this.href.substring(this.href.indexOf('#')+1);
$title.el.className = selectedFont;
changeEditorFont(selectedFont);
setEditorFontClass(selectedFont);
document.querySelector('nav#font-picker li.selected').classList.remove('selected');
this.parentElement.classList.add('selected');
H.set('{{if .Editing}}draft{{.Post.Id}}font{{else}}padFont{{end}}', selectedFont);
@ -378,7 +369,7 @@
});
}
var selectedFont = H.get('{{if .Editing}}draft{{.Post.Id}}font{{else}}padFont{{end}}', '{{.Post.Font}}');
document.addEventListener('DOMContentLoaded', () => {changeEditorFont(selectedFont)});
document.addEventListener('DOMContentLoaded', () => {setEditorFontClass(selectedFont)});
var sfe = document.querySelector('nav#font-picker a.font.'+selectedFont);
if (sfe != null) {
sfe.click();

Loading…
Cancel
Save