Skip to content

Commit

Permalink
style: Format code with standardjs
Browse files Browse the repository at this point in the history
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
deepsource-autofix[bot] committed Mar 22, 2023
1 parent 8e4129c commit 5c168ed
Show file tree
Hide file tree
Showing 74 changed files with 17,979 additions and 21,283 deletions.
3,124 changes: 1,502 additions & 1,622 deletions core/nuadmin.js

Large diffs are not rendered by default.

1,243 changes: 560 additions & 683 deletions core/nuajax.js

Large diffs are not rendered by default.

948 changes: 449 additions & 499 deletions core/nucalendar.js

Large diffs are not rendered by default.

3,901 changes: 1,769 additions & 2,132 deletions core/nucommon.js

Large diffs are not rendered by default.

861 changes: 392 additions & 469 deletions core/nudrag.js

Large diffs are not rendered by default.

10,678 changes: 4,926 additions & 5,752 deletions core/nuform.js

Large diffs are not rendered by default.

2,038 changes: 930 additions & 1,108 deletions core/nuformclass.js

Large diffs are not rendered by default.

2,346 changes: 1,044 additions & 1,302 deletions core/nuformdrag.js

Large diffs are not rendered by default.

2,551 changes: 1,130 additions & 1,421 deletions core/nureportdrag.js

Large diffs are not rendered by default.

668 changes: 334 additions & 334 deletions core/nureportjson.js

Large diffs are not rendered by default.

1,782 changes: 796 additions & 986 deletions core/nuselectclass.js

Large diffs are not rendered by default.

296 changes: 144 additions & 152 deletions core/nuwysiwyg.js
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)
})
}
Loading

0 comments on commit 5c168ed

Please sign in to comment.