@@ -3,8 +3,8 @@ | |||
# For license information, please see license.txt | |||
from __future__ import unicode_literals | |||
import frappe, json | |||
from frappe import _ | |||
import frappe | |||
import json | |||
from frappe.model.document import Document | |||
class InternalWikiPage(Document): | |||
@@ -1,4 +1,4 @@ | |||
frappe.provide('frappe.views') | |||
frappe.provide('frappe.views'); | |||
frappe.pages['wiki'].on_page_load = function(wrapper) { | |||
frappe.ui.make_app_page({ | |||
@@ -12,4 +12,4 @@ frappe.pages['wiki'].on_page_load = function(wrapper) { | |||
$(wrapper).bind('show', function () { | |||
frappe.wiki.show(); | |||
}); | |||
} | |||
}; |
@@ -12,7 +12,7 @@ frappe.views.Wiki = class Wiki { | |||
this.sections = {}; | |||
this.sidebar_items = {}; | |||
this.sorted_sidebar_items = []; | |||
this.tools = {} | |||
this.tools = {}; | |||
this.isReadOnly = true; | |||
this.new_page = null; | |||
this.prepare_container(); | |||
@@ -31,9 +31,9 @@ frappe.views.Wiki = class Wiki { | |||
setup_wiki_pages() { | |||
this.get_pages().then(() => { | |||
if(this.all_pages) { | |||
if (this.all_pages) { | |||
frappe.wiki_pages = {}; | |||
let root_pages = this.all_pages.filter(page => page.parent_page == '' || page.parent_page == null) | |||
let root_pages = this.all_pages.filter(page => page.parent_page == '' || page.parent_page == null); | |||
for (let page of this.all_pages || []) { | |||
frappe.wiki_pages[frappe.router.slug(page.name)] = page; | |||
} | |||
@@ -41,10 +41,10 @@ frappe.views.Wiki = class Wiki { | |||
this.make_sidebar(root_pages); | |||
} | |||
if (this.new_page) { | |||
frappe.set_route(`wiki/${frappe.router.slug(this.new_page)}`) | |||
frappe.set_route(`wiki/${frappe.router.slug(this.new_page)}`); | |||
this.new_page = null; | |||
} | |||
}) | |||
}); | |||
} | |||
get_pages() { | |||
@@ -55,7 +55,7 @@ frappe.views.Wiki = class Wiki { | |||
make_sidebar(items) { | |||
if (this.sidebar.find('.standard-sidebar-section')[0]) { | |||
this.sidebar.find('.standard-sidebar-section')[0].remove() | |||
this.sidebar.find('.standard-sidebar-section')[0].remove(); | |||
} | |||
let sidebar_section = $(`<div class="standard-sidebar-section"></div>`); | |||
@@ -95,25 +95,25 @@ frappe.views.Wiki = class Wiki { | |||
</a> | |||
</div> | |||
`); | |||
} | |||
}; | |||
const make_sidebar_child_item = item => { | |||
let $child_item = get_child_item(item); | |||
$child_item.appendTo(child_item_section) | |||
$child_item.appendTo(child_item_section); | |||
this.sidebar_items[item.name] = $child_item; | |||
} | |||
}; | |||
let $item = get_sidebar_item(item); | |||
let drop_icon = $item.find('.drop-icon').get(0); | |||
let child_item_section = $item.find('.sidebar-child-item').get(0); | |||
if(this.all_pages.some(e => e.parent_page == item.name)) { | |||
if (this.all_pages.some(e => e.parent_page == item.name)) { | |||
drop_icon.classList.remove('hidden'); | |||
drop_icon.addEventListener('click', () => { | |||
child_item_section.classList.toggle("hidden"); | |||
}); | |||
} | |||
let child_items = this.all_pages.filter(page => page.parent_page == item.name) | |||
let child_items = this.all_pages.filter(page => page.parent_page == item.name); | |||
child_items.forEach(item => make_sidebar_child_item(item)); | |||
$item.appendTo(sidebar_section); | |||
@@ -138,7 +138,7 @@ frappe.views.Wiki = class Wiki { | |||
this.show_page(page); | |||
this.get_content(page).then(() => { | |||
this.get_data(page).then(() => { | |||
if(this.content){ | |||
if (this.content) { | |||
this.tools = { | |||
header: { | |||
class: Header, | |||
@@ -176,22 +176,22 @@ frappe.views.Wiki = class Wiki { | |||
}, | |||
blank: frappe.wiki_block.blocks['blank'], | |||
spacingTune: frappe.wiki_block.tunes['spacing_tune'], | |||
} | |||
if(this.editor) { | |||
}; | |||
if (this.editor) { | |||
this.editor.isReady.then(() => { | |||
this.editor.configuration.tools.chart.config.page_data = this.page_data; | |||
this.editor.configuration.tools.shortcut.config.page_data = this.page_data; | |||
this.editor.configuration.tools.card.config.page_data = this.page_data; | |||
this.editor.render({ | |||
blocks: JSON.parse(this.content) || [] | |||
}) | |||
}) | |||
}); | |||
}); | |||
} else { | |||
this.initialize_editorjs(JSON.parse(this.content)); | |||
} | |||
} | |||
}) | |||
}) | |||
}); | |||
}); | |||
} | |||
get_content(page) { | |||
@@ -257,14 +257,14 @@ frappe.views.Wiki = class Wiki { | |||
this.isReadOnly = false; | |||
this.editor.readOnly.toggle(); | |||
this.editor.isReady | |||
.then(() => { | |||
this.undo = new Undo({ editor: this.editor }); | |||
this.undo.initialize({blocks: JSON.parse(this.content)}); | |||
this.setup_customization_buttons(); | |||
this.make_sidebar_sortable(); | |||
this.make_blocks_sortable(); | |||
// this.customize(); | |||
}) | |||
.then(() => { | |||
this.undo = new Undo({ editor: this.editor }); | |||
this.undo.initialize({blocks: JSON.parse(this.content)}); | |||
this.setup_customization_buttons(); | |||
this.make_sidebar_sortable(); | |||
this.make_blocks_sortable(); | |||
// this.customize(); | |||
}); | |||
}, | |||
); | |||
@@ -279,14 +279,14 @@ frappe.views.Wiki = class Wiki { | |||
handle: ".standard-sidebar-item-container", | |||
draggable: ".standard-sidebar-item-container", | |||
animation: 150, | |||
onEnd: function (evt){ | |||
onEnd: function (evt) { | |||
let new_sb_items = []; | |||
let old_sb_items = me.all_pages.filter(page => page.parent_page == '' || page.parent_page == null) | |||
let old_sb_items = me.all_pages.filter(page => page.parent_page == '' || page.parent_page == null); | |||
for (let page of evt.srcElement.childNodes) { | |||
new_sb_items.push({ | |||
name: page.attributes['item-name'].value, | |||
sequence_id: parseInt(page.attributes['item-sequence'].value) | |||
}) | |||
}); | |||
} | |||
me.sorted_sidebar_items = []; | |||
new_sb_items.forEach((old, index) => { | |||
@@ -305,7 +305,7 @@ frappe.views.Wiki = class Wiki { | |||
handle: ".drag-handle", | |||
draggable: ".ce-block", | |||
animation: 150, | |||
onEnd: function (evt){ | |||
onEnd: function (evt) { | |||
me.editor.blocks.move(evt.newIndex, evt.oldIndex); | |||
}, | |||
setData: function (dataTransfer, dragEl) { | |||
@@ -377,14 +377,14 @@ frappe.views.Wiki = class Wiki { | |||
} | |||
] | |||
}).then(() => { | |||
if(this.editor.configuration.readOnly) { | |||
if (this.editor.configuration.readOnly) { | |||
this.isReadOnly = false; | |||
this.editor.readOnly.toggle(); | |||
} | |||
this.make_sidebar_sortable(); | |||
this.make_blocks_sortable(); | |||
this.dirty = false; | |||
}) | |||
}); | |||
} | |||
}); | |||
d.show(); | |||
@@ -394,7 +394,7 @@ frappe.views.Wiki = class Wiki { | |||
this.dirty = false; | |||
const data = { | |||
blocks: blocks || [] | |||
} | |||
}; | |||
this.editor = new EditorJS({ | |||
tools: this.tools, | |||
autofocus: false, | |||
@@ -421,11 +421,11 @@ frappe.views.Wiki = class Wiki { | |||
if (item.data.new) { | |||
if (!new_widgets[item.type]) { | |||
new_widgets[item.type] = [] | |||
} | |||
}; | |||
new_widgets[item.type].push(item.data.new); | |||
delete item.data['new']; | |||
} | |||
}) | |||
}); | |||
frappe.call({ | |||
method: "frappe.desk.doctype.internal_wiki_page.internal_wiki_page.save_wiki_page", | |||
@@ -445,7 +445,7 @@ frappe.views.Wiki = class Wiki { | |||
page: me.title, | |||
new_widgets: new_widgets | |||
}).then(res => { | |||
if(res.message) { | |||
if (res.message) { | |||
me.reload(); | |||
} | |||
}); | |||
@@ -460,7 +460,8 @@ frappe.views.Wiki = class Wiki { | |||
} | |||
}); | |||
}).catch((error) => { | |||
console.log('Saving failed: ', error); | |||
error; | |||
// console.log('Saving failed: ', error); | |||
}); | |||
} | |||
@@ -468,4 +469,4 @@ frappe.views.Wiki = class Wiki { | |||
this.setup_wiki_pages(); | |||
this.dirty = false; | |||
} | |||
} | |||
}; |
@@ -10,7 +10,7 @@ export default class Blank { | |||
return true; | |||
} | |||
constructor({data, api, config, readOnly}){ | |||
constructor({data, api, config, readOnly}) { | |||
this.data = data; | |||
this.api = api; | |||
this.config = config; | |||
@@ -39,22 +39,22 @@ export default class Blank { | |||
pr: this._getPadding("r"), | |||
pb: this._getPadding("b"), | |||
pl: this._getPadding("l") | |||
} | |||
}; | |||
} | |||
rendered() { | |||
var e = this.wrapper.parentNode.parentNode; | |||
e.classList.add("col-" + this.col) | |||
e.classList.add("pt-" + this.pt) | |||
e.classList.add("pr-" + this.pr) | |||
e.classList.add("pb-" + this.pb) | |||
e.classList.add("pl-" + this.pl) | |||
e.classList.add("col-" + this.col); | |||
e.classList.add("pt-" + this.pt); | |||
e.classList.add("pr-" + this.pr); | |||
e.classList.add("pb-" + this.pb); | |||
e.classList.add("pl-" + this.pl); | |||
} | |||
_getCol() { | |||
var e = 12, | |||
t = "col-12", | |||
n = this.wrapper.parentNode.parentNode, | |||
var e = 12; | |||
t = "col-12"; | |||
n = this.wrapper.parentNode.parentNode; | |||
r = new RegExp(/\bcol-.+?\b/, "g"); | |||
if (n.className.match(r)) { | |||
n.classList.forEach(function (e) { | |||
@@ -67,13 +67,13 @@ export default class Blank { | |||
} | |||
_getPadding() { | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l", | |||
t = 0, | |||
n = "p" + e + "-0", | |||
r = this.wrapper.parentNode.parentNode, | |||
a = new RegExp(/\pl-.+?\b/, "g"), | |||
i = new RegExp(/\pr-.+?\b/, "g"), | |||
o = new RegExp(/\pt-.+?\b/, "g"), | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l"; | |||
t = 0; | |||
n = "p" + e + "-0"; | |||
r = this.wrapper.parentNode.parentNode; | |||
a = new RegExp(/\pl-.+?\b/, "g"); | |||
i = new RegExp(/\pr-.+?\b/, "g"); | |||
o = new RegExp(/\pt-.+?\b/, "g"); | |||
c = new RegExp(/\pb-.+?\b/, "g"); | |||
if ("l" == e) { | |||
if (r.className.match(a)) { | |||
@@ -19,5 +19,5 @@ frappe.wiki_block.blocks = { | |||
}; | |||
frappe.wiki_block.tunes = { | |||
spacing_tune : SpacingTune | |||
} | |||
spacing_tune: SpacingTune | |||
}; |
@@ -11,7 +11,7 @@ export default class Card { | |||
return true; | |||
} | |||
constructor({data, api, config, readOnly, block}){ | |||
constructor({data, api, config, readOnly}) { | |||
this.data = data; | |||
this.api = api; | |||
this.config = config; | |||
@@ -29,7 +29,7 @@ export default class Card { | |||
allow_delete: this.allow_customization, | |||
allow_hiding: false, | |||
allow_edit: false, | |||
} | |||
}; | |||
} | |||
render() { | |||
@@ -37,7 +37,7 @@ export default class Card { | |||
this._new_card(); | |||
if (this.data && this.data.card_name) { | |||
this._make_cards(this.data.card_name) | |||
this._make_cards(this.data.card_name); | |||
} | |||
return this.wrapper; | |||
} | |||
@@ -51,16 +51,16 @@ export default class Card { | |||
pb: this._getPadding("b"), | |||
pl: this._getPadding("l"), | |||
new: this.new_card_widget | |||
} | |||
}; | |||
} | |||
rendered() { | |||
var e = this.wrapper.parentNode.parentNode; | |||
e.classList.add("col-" + this.col) | |||
e.classList.add("pt-" + this.pt) | |||
e.classList.add("pr-" + this.pr) | |||
e.classList.add("pb-" + this.pb) | |||
e.classList.add("pl-" + this.pl) | |||
e.classList.add("col-" + this.col); | |||
e.classList.add("pt-" + this.pt); | |||
e.classList.add("pr-" + this.pr); | |||
e.classList.add("pb-" + this.pb); | |||
e.classList.add("pl-" + this.pl); | |||
} | |||
_new_card() { | |||
@@ -88,9 +88,9 @@ export default class Card { | |||
} | |||
_getCol() { | |||
var e = 12, | |||
t = "col-12", | |||
n = this.wrapper.parentNode.parentNode, | |||
var e = 12; | |||
t = "col-12"; | |||
n = this.wrapper.parentNode.parentNode; | |||
r = new RegExp(/\bcol-.+?\b/, "g"); | |||
if (n.className.match(r)) { | |||
n.classList.forEach(function (e) { | |||
@@ -103,13 +103,13 @@ export default class Card { | |||
} | |||
_getPadding() { | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l", | |||
t = 0, | |||
n = "p" + e + "-0", | |||
r = this.wrapper.parentNode.parentNode, | |||
a = new RegExp(/\pl-.+?\b/, "g"), | |||
i = new RegExp(/\pr-.+?\b/, "g"), | |||
o = new RegExp(/\pt-.+?\b/, "g"), | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l"; | |||
t = 0; | |||
n = "p" + e + "-0"; | |||
r = this.wrapper.parentNode.parentNode; | |||
a = new RegExp(/\pl-.+?\b/, "g"); | |||
i = new RegExp(/\pr-.+?\b/, "g"); | |||
o = new RegExp(/\pt-.+?\b/, "g"); | |||
c = new RegExp(/\pb-.+?\b/, "g"); | |||
if ("l" == e) { | |||
if (r.className.match(a)) { | |||
@@ -155,7 +155,7 @@ export default class Card { | |||
_make_cards(card_name) { | |||
let card = this.config.page_data.cards.items.find(obj => { | |||
return obj.label == card_name | |||
return obj.label == card_name; | |||
}); | |||
this.wrapper.innerHTML = ''; | |||
card.in_customize_mode = !this.readOnly; | |||
@@ -10,7 +10,7 @@ export default class Chart { | |||
return true; | |||
} | |||
constructor({data, api, config, readOnly}){ | |||
constructor({data, api, config, readOnly}) { | |||
this.data = data; | |||
this.api = api; | |||
this.config = config; | |||
@@ -34,12 +34,12 @@ export default class Chart { | |||
options: this.config.page_data.charts.items.map(({ chart_name }) => chart_name), | |||
change: function() { | |||
if (this.value) { | |||
me._make_charts(this.value) | |||
me._make_charts(this.value); | |||
} | |||
} | |||
}]); | |||
if (this.data && this.data.chart_name) { | |||
this._make_charts(this.data.chart_name) | |||
this._make_charts(this.data.chart_name); | |||
} | |||
return this.wrapper; | |||
} | |||
@@ -52,22 +52,22 @@ export default class Chart { | |||
pr: this._getPadding("r"), | |||
pb: this._getPadding("b"), | |||
pl: this._getPadding("l") | |||
} | |||
}; | |||
} | |||
rendered() { | |||
var e = this.wrapper.parentNode.parentNode; | |||
e.classList.add("col-" + this.col) | |||
e.classList.add("pt-" + this.pt) | |||
e.classList.add("pr-" + this.pr) | |||
e.classList.add("pb-" + this.pb) | |||
e.classList.add("pl-" + this.pl) | |||
e.classList.add("col-" + this.col); | |||
e.classList.add("pt-" + this.pt); | |||
e.classList.add("pr-" + this.pr); | |||
e.classList.add("pb-" + this.pb); | |||
e.classList.add("pl-" + this.pl); | |||
} | |||
_getCol() { | |||
var e = 12, | |||
t = "col-12", | |||
n = this.wrapper.parentNode.parentNode, | |||
var e = 12; | |||
t = "col-12"; | |||
n = this.wrapper.parentNode.parentNode; | |||
r = new RegExp(/\bcol-.+?\b/, "g"); | |||
if (n.className.match(r)) { | |||
n.classList.forEach(function (e) { | |||
@@ -80,13 +80,13 @@ export default class Chart { | |||
} | |||
_getPadding() { | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l", | |||
t = 0, | |||
n = "p" + e + "-0", | |||
r = this.wrapper.parentNode.parentNode, | |||
a = new RegExp(/\pl-.+?\b/, "g"), | |||
i = new RegExp(/\pr-.+?\b/, "g"), | |||
o = new RegExp(/\pt-.+?\b/, "g"), | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l"; | |||
t = 0; | |||
n = "p" + e + "-0"; | |||
r = this.wrapper.parentNode.parentNode; | |||
a = new RegExp(/\pl-.+?\b/, "g"); | |||
i = new RegExp(/\pr-.+?\b/, "g"); | |||
o = new RegExp(/\pt-.+?\b/, "g"); | |||
c = new RegExp(/\pb-.+?\b/, "g"); | |||
if ("l" == e) { | |||
if (r.className.match(a)) { | |||
@@ -132,7 +132,7 @@ export default class Chart { | |||
_make_charts(chart_name) { | |||
let chart = this.config.page_data.charts.items.find(obj => { | |||
return obj.chart_name == chart_name | |||
return obj.chart_name == chart_name; | |||
}); | |||
this.wrapper.innerHTML = ''; | |||
this.sections = {}; | |||
@@ -153,7 +153,7 @@ export default class Chart { | |||
}, | |||
widgets: chart | |||
}); | |||
this.wrapper.setAttribute("chart_name", chart_name) | |||
this.wrapper.setAttribute("chart_name", chart_name); | |||
if (!this.readOnly) { | |||
this.sections["charts"].customize(); | |||
} | |||
@@ -62,7 +62,7 @@ export default class Paragraph { | |||
merge(data) { | |||
let newData = { | |||
text : this.data.text + data.text | |||
text: this.data.text + data.text | |||
}; | |||
this.data = newData; | |||
@@ -70,7 +70,7 @@ export default class Paragraph { | |||
validate(savedData) { | |||
if (savedData.text.trim() === '' && !this._preserveBlank) { | |||
return false; | |||
return false; | |||
} | |||
return true; | |||
@@ -89,17 +89,17 @@ export default class Paragraph { | |||
rendered() { | |||
var e = this._element.parentNode.parentNode; | |||
e.classList.add("col-" + this.col) | |||
e.classList.add("pt-" + this.pt) | |||
e.classList.add("pr-" + this.pr) | |||
e.classList.add("pb-" + this.pb) | |||
e.classList.add("pl-" + this.pl) | |||
e.classList.add("col-" + this.col); | |||
e.classList.add("pt-" + this.pt); | |||
e.classList.add("pr-" + this.pr); | |||
e.classList.add("pb-" + this.pb); | |||
e.classList.add("pl-" + this.pl); | |||
} | |||
_getCol() { | |||
var e = 12, | |||
t = "col-12", | |||
n = this._element.parentNode.parentNode, | |||
var e = 12; | |||
t = "col-12"; | |||
n = this._element.parentNode.parentNode; | |||
r = new RegExp(/\bcol-.+?\b/, "g"); | |||
if (n.className.match(r)) { | |||
n.classList.forEach(function (e) { | |||
@@ -112,13 +112,13 @@ export default class Paragraph { | |||
} | |||
_getPadding() { | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l", | |||
t = 0, | |||
n = "p" + e + "-0", | |||
r = this._element.parentNode.parentNode, | |||
a = new RegExp(/\pl-.+?\b/, "g"), | |||
i = new RegExp(/\pr-.+?\b/, "g"), | |||
o = new RegExp(/\pt-.+?\b/, "g"), | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l"; | |||
t = 0; | |||
n = "p" + e + "-0"; | |||
r = this._element.parentNode.parentNode; | |||
a = new RegExp(/\pl-.+?\b/, "g"); | |||
i = new RegExp(/\pr-.+?\b/, "g"); | |||
o = new RegExp(/\pt-.+?\b/, "g"); | |||
c = new RegExp(/\pb-.+?\b/, "g"); | |||
if ("l" == e) { | |||
if (r.className.match(a)) { | |||
@@ -156,7 +156,7 @@ export default class Paragraph { | |||
onPaste(event) { | |||
const data = { | |||
text: event.detail.data.innerHTML | |||
text: event.detail.data.innerHTML | |||
}; | |||
this.data = data; | |||
@@ -164,16 +164,16 @@ export default class Paragraph { | |||
static get conversionConfig() { | |||
return { | |||
export: 'text', // to convert Paragraph to other block, use 'text' property of saved data | |||
import: 'text' // to covert other block's exported string to Paragraph, fill 'text' property of tool data | |||
export: 'text', // to convert Paragraph to other block, use 'text' property of saved data | |||
import: 'text' // to covert other block's exported string to Paragraph, fill 'text' property of tool data | |||
}; | |||
} | |||
static get sanitize() { | |||
return { | |||
text: { | |||
br: true, | |||
} | |||
text: { | |||
br: true, | |||
} | |||
}; | |||
} | |||
@@ -197,7 +197,7 @@ export default class Paragraph { | |||
static get pasteConfig() { | |||
return { | |||
tags: [ 'P' ] | |||
tags: [ 'P' ] | |||
}; | |||
} | |||
@@ -11,7 +11,7 @@ export default class Shortcut { | |||
return true; | |||
} | |||
constructor({data, api, config, readOnly}){ | |||
constructor({data, api, config, readOnly}) { | |||
this.data = data; | |||
this.api = api; | |||
this.config = config; | |||
@@ -28,7 +28,7 @@ export default class Shortcut { | |||
allow_delete: this.allow_customization, | |||
allow_hiding: false, | |||
allow_edit: true, | |||
} | |||
}; | |||
} | |||
render() { | |||
@@ -36,7 +36,7 @@ export default class Shortcut { | |||
this._new_shortcut(); | |||
if (this.data && this.data.shortcut_name) { | |||
this._make_shortcuts(this.data.shortcut_name) | |||
this._make_shortcuts(this.data.shortcut_name); | |||
} | |||
return this.wrapper; | |||
} | |||
@@ -50,16 +50,16 @@ export default class Shortcut { | |||
pb: this._getPadding("b"), | |||
pl: this._getPadding("l"), | |||
new: this.new_shortcut_widget | |||
} | |||
}; | |||
} | |||
rendered() { | |||
var e = this.wrapper.parentNode.parentNode; | |||
e.classList.add("col-" + this.col) | |||
e.classList.add("pt-" + this.pt) | |||
e.classList.add("pr-" + this.pr) | |||
e.classList.add("pb-" + this.pb) | |||
e.classList.add("pl-" + this.pl) | |||
e.classList.add("col-" + this.col); | |||
e.classList.add("pt-" + this.pt); | |||
e.classList.add("pr-" + this.pr); | |||
e.classList.add("pb-" + this.pb); | |||
e.classList.add("pl-" + this.pl); | |||
} | |||
_new_shortcut() { | |||
@@ -87,9 +87,9 @@ export default class Shortcut { | |||
} | |||
_getCol() { | |||
var e = 12, | |||
t = "col-12", | |||
n = this.wrapper.parentNode.parentNode, | |||
var e = 12; | |||
t = "col-12"; | |||
n = this.wrapper.parentNode.parentNode; | |||
r = new RegExp(/\bcol-.+?\b/, "g"); | |||
if (n.className.match(r)) { | |||
n.classList.forEach(function (e) { | |||
@@ -102,13 +102,13 @@ export default class Shortcut { | |||
} | |||
_getPadding() { | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l", | |||
t = 0, | |||
n = "p" + e + "-0", | |||
r = this.wrapper.parentNode.parentNode, | |||
a = new RegExp(/\pl-.+?\b/, "g"), | |||
i = new RegExp(/\pr-.+?\b/, "g"), | |||
o = new RegExp(/\pt-.+?\b/, "g"), | |||
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "l"; | |||
t = 0; | |||
n = "p" + e + "-0"; | |||
r = this.wrapper.parentNode.parentNode; | |||
a = new RegExp(/\pl-.+?\b/, "g"); | |||
i = new RegExp(/\pr-.+?\b/, "g"); | |||
o = new RegExp(/\pt-.+?\b/, "g"); | |||
c = new RegExp(/\pb-.+?\b/, "g"); | |||
if ("l" == e) { | |||
if (r.className.match(a)) { | |||
@@ -154,7 +154,7 @@ export default class Shortcut { | |||
_make_shortcuts(shortcut_name) { | |||
let shortcut = this.config.page_data.shortcuts.items.find(obj => { | |||
return obj.label == shortcut_name | |||
return obj.label == shortcut_name; | |||
}); | |||
this.wrapper.innerHTML = ''; | |||
shortcut.in_customize_mode = !this.readOnly; | |||
@@ -71,7 +71,7 @@ export default class SpacingTune { | |||
} | |||
let currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -82,13 +82,13 @@ export default class SpacingTune { | |||
let colClass = new RegExp(/\bcol-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(colClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(colClass)){ | |||
if (cn.match(colClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let width = parseInt(parts[1]); | |||
if(width >= 2){ | |||
if (width >= 2) { | |||
currentBlockElement.classList.remove('col-'+width); | |||
width = width - 1; | |||
currentBlockElement.classList.add('col-'+width); | |||
@@ -104,7 +104,7 @@ export default class SpacingTune { | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -115,23 +115,23 @@ export default class SpacingTune { | |||
const colClass = new RegExp(/\bcol-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(colClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(colClass)){ | |||
className = cn; | |||
} | |||
if (cn.match(colClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let width = parseInt(parts[1]); | |||
if(width <= 11){ | |||
currentBlockElement.classList.remove('col-'+width); | |||
width = width + 1; | |||
if (width <= 11) { | |||
currentBlockElement.classList.remove('col-'+width); | |||
width = width + 1; | |||
currentBlockElement.classList.add('col-'+width); | |||
} | |||
} | |||
} | |||
} | |||
showPadding(event, button) { | |||
let me = this; | |||
if(button.classList.contains('cdx-settings-button--active')){ | |||
if (button.classList.contains('cdx-settings-button--active')) { | |||
this.sidebar.remove(); | |||
button.classList.remove('cdx-settings-button--active'); | |||
} else { | |||
@@ -290,12 +290,12 @@ export default class SpacingTune { | |||
increasePaddingLeft(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -306,13 +306,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pl-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding <= 4){ | |||
if (padding <= 4) { | |||
currentBlockElement.classList.remove('pl-'+padding); | |||
padding = padding + 1; | |||
currentBlockElement.classList.add('pl-'+padding); | |||
@@ -324,12 +324,12 @@ export default class SpacingTune { | |||
decreasePaddingLeft(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -340,13 +340,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pl-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding >= 1){ | |||
if (padding >= 1) { | |||
currentBlockElement.classList.remove('pl-'+padding); | |||
padding = padding - 1; | |||
currentBlockElement.classList.add('pl-'+padding); | |||
@@ -357,12 +357,12 @@ export default class SpacingTune { | |||
increasePaddingRight(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -373,13 +373,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pr-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding <= 4){ | |||
if (padding <= 4) { | |||
currentBlockElement.classList.remove('pr-'+padding); | |||
padding = padding + 1; | |||
currentBlockElement.classList.add('pr-'+padding); | |||
@@ -390,12 +390,12 @@ export default class SpacingTune { | |||
decreasePaddingRight(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -406,13 +406,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pr-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding >= 1){ | |||
if (padding >= 1) { | |||
currentBlockElement.classList.remove('pr-'+padding); | |||
padding = padding - 1; | |||
currentBlockElement.classList.add('pr-'+padding); | |||
@@ -423,12 +423,12 @@ export default class SpacingTune { | |||
increasePaddingTop(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -439,13 +439,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pt-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding <= 4){ | |||
if (padding <= 4) { | |||
currentBlockElement.classList.remove('pt-'+padding); | |||
padding = padding + 1; | |||
currentBlockElement.classList.add('pt-'+padding); | |||
@@ -456,12 +456,12 @@ export default class SpacingTune { | |||
decreasePaddingTop(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -472,13 +472,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pt-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding >= 1){ | |||
if (padding >= 1) { | |||
currentBlockElement.classList.remove('pt-'+padding); | |||
padding = padding - 1; | |||
currentBlockElement.classList.add('pt-'+padding); | |||
@@ -489,12 +489,12 @@ export default class SpacingTune { | |||
increasePaddingBottom(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -505,13 +505,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pb-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding <= 4){ | |||
if (padding <= 4) { | |||
currentBlockElement.classList.remove('pb-'+padding); | |||
padding = padding + 1; | |||
currentBlockElement.classList.add('pb-'+padding); | |||
@@ -522,12 +522,12 @@ export default class SpacingTune { | |||
decreasePaddingBottom(event, button) { | |||
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex(); | |||
if(currentBlockIndex < 0){ | |||
if (currentBlockIndex < 0) { | |||
return; | |||
} | |||
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex); | |||
if (!currentBlock){ | |||
if (!currentBlock) { | |||
return; | |||
} | |||
@@ -538,13 +538,13 @@ export default class SpacingTune { | |||
const paddingClass = new RegExp(/\pb-.+?\b/, 'g'); | |||
if (currentBlockElement.className.match(paddingClass)) { | |||
currentBlockElement.classList.forEach( cn => { | |||
if(cn.match(paddingClass)){ | |||
if (cn.match(paddingClass)) { | |||
className = cn; | |||
} | |||
}); | |||
let parts = className.split('-'); | |||
let padding = parseInt(parts[1]); | |||
if(padding >= 1){ | |||
if (padding >= 1) { | |||
currentBlockElement.classList.remove('pb-'+padding); | |||
padding = padding - 1; | |||
currentBlockElement.classList.add('pb-'+padding); | |||
@@ -11,6 +11,28 @@ | |||
} | |||
} | |||
} | |||
.standard-sidebar-item { | |||
justify-content: space-between; | |||
} | |||
.sidebar-child-item-container { | |||
margin-left: 10px; | |||
.standard-sidebar-item { | |||
justify-content: start; | |||
} | |||
} | |||
.sidebar-item-label { | |||
flex: 1; | |||
} | |||
.item-anchor { | |||
display: flex; | |||
overflow: hidden; | |||
flex: 1; | |||
} | |||
} | |||
.ce-header { | |||
@@ -124,31 +146,4 @@ | |||
height: 145px; | |||
box-shadow: 0 3px 15px -3px rgba(13,20,33,.13); | |||
border-radius: 0 4px 4px 0;z-index: 0; | |||
} | |||
[data-page-route="wiki"] { | |||
.standard-sidebar-item { | |||
justify-content: space-between; | |||
} | |||
.sidebar-child-item-container { | |||
margin-left: 10px; | |||
.standard-sidebar-item { | |||
justify-content: start; | |||
} | |||
} | |||
.sidebar-item-label { | |||
flex: 1; | |||
} | |||
.item-anchor { | |||
display: flex; | |||
overflow: hidden; | |||
flex: 1; | |||
} | |||
} |