-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format code with standardjs This commit fixes the style issues introduced in cf3476a according to the output from standardjs. Details: https://deepsource.io/gh/smalos/nubuilder_dev/transform/04bfcafd-de01-4db8-932d-9df5bed8ea8b/
- Loading branch information
1 parent
8e4129c
commit 5c168ed
Showing
74 changed files
with
17,979 additions
and
21,283 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,157 +1,149 @@ | ||
function nuInitTinyMCE(id, options, mobile, toolbar, toolbar_groups, menubar, contextmenu, quickbars) { | ||
|
||
nuHide(id); | ||
|
||
let plugins; | ||
|
||
if (options) { | ||
if ($.type(options) !== 'object') { | ||
plugins = options; | ||
options = undefined; | ||
} | ||
} | ||
|
||
if (!tinymce) { | ||
nuMessage(["<h2>TinyMCE is not included</h2>", "Set $nuConfigIncludeTinyMCE = true in nuconfig.php"]); | ||
return; | ||
} | ||
|
||
let idContainer = id + '_container'; | ||
|
||
let useDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; | ||
let obj = document.getElementById(idContainer); | ||
|
||
var _plugins; | ||
if (!plugins) { | ||
_plugins = 'code preview importcss searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists help charmap emoticons'; | ||
} else { | ||
_plugins = plugins; | ||
} | ||
|
||
var _mobile; | ||
if (!mobile) { | ||
_mobile = { | ||
plugins: 'preview importcss searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists help charmap emoticons' | ||
} | ||
} else { | ||
_mobile = mobile; | ||
} | ||
|
||
var _toolbar; | ||
if (!toolbar) { | ||
_toolbar = 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor casechange formatpainter removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media pageembed link anchor codesample | a11ycheck ltr rtl | showcomments addcomment'; | ||
} else { | ||
|
||
if (toolbar == 'minimal') { | ||
_toolbar = 'undo redo | bold italic underline strikethrough | image link | bullist | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | forecolor backcolor | fullscreen'; | ||
} else { | ||
_toolbar = toolbar; | ||
} | ||
} | ||
|
||
var _toolbar_groups; | ||
if (!toolbar_groups) { | ||
_toolbar_groups = {}; | ||
} else { | ||
_toolbar_groups = toolbar_groups; | ||
} | ||
|
||
var _menubar; | ||
if (!menubar) { | ||
_menubar = 'file edit view insert format tools table tc help'; | ||
} else { | ||
_menubar = menubar; | ||
} | ||
|
||
var _contextmenu; | ||
if (!contextmenu) { | ||
_contextmenu = 'image table configurepermanentpen'; | ||
} else { | ||
_contextmenu = contextmenu; | ||
} | ||
|
||
var _quickbars; | ||
if (!quickbars) { | ||
_quickbars = 'bold italic | quicklink h2 h3 blockquote quickimage quicktable'; | ||
} else { | ||
_quickbars = quickbars; | ||
} | ||
|
||
let defaultOptions = { | ||
selector: "#" + idContainer, | ||
plugins: _plugins, | ||
mobile: _mobile, | ||
menu: { | ||
tc: { | ||
title: 'Comments', | ||
items: 'addcomment showcomments deleteallconversations' | ||
} | ||
}, | ||
external_plugins: {}, | ||
menubar: _menubar, | ||
resize: true, | ||
toolbar: _toolbar, | ||
toolbar_groups: _toolbar_groups, | ||
autosave_ask_before_unload: true, | ||
autosave_interval: '30s', | ||
autosave_prefix: '{path}{query}-{id}-', | ||
autosave_restore_when_empty: false, | ||
autosave_retention: '2m', | ||
elementpath: false, | ||
image_advtab: true, | ||
importcss_append: true, | ||
height: obj.clientHeight, | ||
width: obj.clientWidth, | ||
image_caption: true, | ||
quickbars_selection_toolbar: _quickbars, | ||
noneditable_noneditable_class: 'mceNonEditable', | ||
toolbar_mode: 'sliding', | ||
content_style: "p { margin: 0; }", | ||
contextmenu: _contextmenu, | ||
skin: useDarkMode ? 'oxide-dark' : 'oxide', | ||
content_css: useDarkMode ? 'dark' : 'default', | ||
cache_suffix: '?v=6.3.0', | ||
setup: function (editor) { | ||
|
||
editor.on('init', function (e) { | ||
|
||
e.target.setContent(nuGetValue(id)); | ||
if (window.nuTinyMCEOnInit) { | ||
nuTinyMCEOnInit(e, editor); | ||
} | ||
}); | ||
|
||
editor.on("change", function () { | ||
nuTinyMCEOnChangeHandler(editor); | ||
}); | ||
|
||
} | ||
}; | ||
|
||
let mergedOptions = defaultOptions; | ||
|
||
if (options) { | ||
mergedOptions = $.extend(defaultOptions, options) | ||
} | ||
|
||
if (tinymce.get(idContainer)) { | ||
tinymce.remove("#" + idContainer); | ||
} | ||
|
||
tinymce.init(mergedOptions); | ||
|
||
function nuInitTinyMCE (id, options, mobile, toolbar, toolbar_groups, menubar, contextmenu, quickbars) { | ||
nuHide(id) | ||
|
||
let plugins | ||
|
||
if (options) { | ||
if ($.type(options) !== 'object') { | ||
plugins = options | ||
options = undefined | ||
} | ||
} | ||
|
||
if (!tinymce) { | ||
nuMessage(['<h2>TinyMCE is not included</h2>', 'Set $nuConfigIncludeTinyMCE = true in nuconfig.php']) | ||
return | ||
} | ||
|
||
const idContainer = id + '_container' | ||
|
||
const useDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches | ||
const obj = document.getElementById(idContainer) | ||
|
||
let _plugins | ||
if (!plugins) { | ||
_plugins = 'code preview importcss searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists help charmap emoticons' | ||
} else { | ||
_plugins = plugins | ||
} | ||
|
||
let _mobile | ||
if (!mobile) { | ||
_mobile = { | ||
plugins: 'preview importcss searchreplace autolink autosave save directionality visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists help charmap emoticons' | ||
} | ||
} else { | ||
_mobile = mobile | ||
} | ||
|
||
let _toolbar | ||
if (!toolbar) { | ||
_toolbar = 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor casechange formatpainter removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media pageembed link anchor codesample | a11ycheck ltr rtl | showcomments addcomment' | ||
} else { | ||
if (toolbar == 'minimal') { | ||
_toolbar = 'undo redo | bold italic underline strikethrough | image link | bullist | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | forecolor backcolor | fullscreen' | ||
} else { | ||
_toolbar = toolbar | ||
} | ||
} | ||
|
||
let _toolbar_groups | ||
if (!toolbar_groups) { | ||
_toolbar_groups = {} | ||
} else { | ||
_toolbar_groups = toolbar_groups | ||
} | ||
|
||
let _menubar | ||
if (!menubar) { | ||
_menubar = 'file edit view insert format tools table tc help' | ||
} else { | ||
_menubar = menubar | ||
} | ||
|
||
let _contextmenu | ||
if (!contextmenu) { | ||
_contextmenu = 'image table configurepermanentpen' | ||
} else { | ||
_contextmenu = contextmenu | ||
} | ||
|
||
let _quickbars | ||
if (!quickbars) { | ||
_quickbars = 'bold italic | quicklink h2 h3 blockquote quickimage quicktable' | ||
} else { | ||
_quickbars = quickbars | ||
} | ||
|
||
const defaultOptions = { | ||
selector: '#' + idContainer, | ||
plugins: _plugins, | ||
mobile: _mobile, | ||
menu: { | ||
tc: { | ||
title: 'Comments', | ||
items: 'addcomment showcomments deleteallconversations' | ||
} | ||
}, | ||
external_plugins: {}, | ||
menubar: _menubar, | ||
resize: true, | ||
toolbar: _toolbar, | ||
toolbar_groups: _toolbar_groups, | ||
autosave_ask_before_unload: true, | ||
autosave_interval: '30s', | ||
autosave_prefix: '{path}{query}-{id}-', | ||
autosave_restore_when_empty: false, | ||
autosave_retention: '2m', | ||
elementpath: false, | ||
image_advtab: true, | ||
importcss_append: true, | ||
height: obj.clientHeight, | ||
width: obj.clientWidth, | ||
image_caption: true, | ||
quickbars_selection_toolbar: _quickbars, | ||
noneditable_noneditable_class: 'mceNonEditable', | ||
toolbar_mode: 'sliding', | ||
content_style: 'p { margin: 0; }', | ||
contextmenu: _contextmenu, | ||
skin: useDarkMode ? 'oxide-dark' : 'oxide', | ||
content_css: useDarkMode ? 'dark' : 'default', | ||
cache_suffix: '?v=6.3.0', | ||
setup: function (editor) { | ||
editor.on('init', function (e) { | ||
e.target.setContent(nuGetValue(id)) | ||
if (window.nuTinyMCEOnInit) { | ||
nuTinyMCEOnInit(e, editor) | ||
} | ||
}) | ||
|
||
editor.on('change', function () { | ||
nuTinyMCEOnChangeHandler(editor) | ||
}) | ||
} | ||
} | ||
|
||
let mergedOptions = defaultOptions | ||
|
||
if (options) { | ||
mergedOptions = $.extend(defaultOptions, options) | ||
} | ||
|
||
if (tinymce.get(idContainer)) { | ||
tinymce.remove('#' + idContainer) | ||
} | ||
|
||
tinymce.init(mergedOptions) | ||
} | ||
|
||
function nuTinyMCEOnChangeHandler(editor) { | ||
nuHasBeenEdited(); | ||
function nuTinyMCEOnChangeHandler (editor) { | ||
nuHasBeenEdited() | ||
} | ||
|
||
function nuSaveEditor() { | ||
|
||
$('.nuTinyMCE').each((index, element) => { | ||
let myContent = tinymce.get(element.id).getContent(); | ||
let id = element.id.slice(0, -10); | ||
nuSetValue(id, myContent); | ||
}); | ||
|
||
function nuSaveEditor () { | ||
$('.nuTinyMCE').each((index, element) => { | ||
const myContent = tinymce.get(element.id).getContent() | ||
const id = element.id.slice(0, -10) | ||
nuSetValue(id, myContent) | ||
}) | ||
} |
Oops, something went wrong.