started pell parsing on form import
This commit is contained in:
parent
461ba0e85c
commit
5eb216f395
@ -418,7 +418,7 @@ function buildSidebarList(obj, sidebarList) {
|
||||
|
||||
function buildLongTextInput(source, textarea, label) {
|
||||
|
||||
if (activeState.settings.enablePell == "false") return;
|
||||
if (!activeState.settings.enablePell) return;
|
||||
//hide default textarea
|
||||
textarea.style.display = "none";
|
||||
label.style.display = "none";
|
||||
@ -440,7 +440,7 @@ function buildLongTextInput(source, textarea, label) {
|
||||
"heading2",
|
||||
{
|
||||
name: 'ulist',
|
||||
icon: 'L'
|
||||
icon: '<b>•</b>'
|
||||
},
|
||||
"olist"
|
||||
],
|
||||
|
||||
@ -129,7 +129,7 @@ function printVersion(msg = "") {
|
||||
}
|
||||
|
||||
function clickImportFiles() {
|
||||
if (activeState.settings.localOnly == "true") {
|
||||
if (activeState.settings.localOnly) {
|
||||
createBookShelfDownload();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -26,14 +26,14 @@ window.activeState = {
|
||||
lastElement: "",
|
||||
serverFilesTs: "",
|
||||
settings: {
|
||||
localOnly: "true",
|
||||
localOnly: true,
|
||||
lineBreak: 120,
|
||||
font: "Arial",
|
||||
fontSize: "10px",
|
||||
notifierPause: 1,
|
||||
persistentStorage: "false",
|
||||
enablePell: "false",
|
||||
debug: "false"
|
||||
persistentStorage: false,
|
||||
enablePell: false,
|
||||
debug: false
|
||||
},
|
||||
templates: [],
|
||||
templateObjectsPurified: [],
|
||||
@ -73,6 +73,8 @@ function init() {
|
||||
let settings = storeSettings("getInit", true);
|
||||
if (settings != null) {
|
||||
for (let setting of Object.entries(settings)) {
|
||||
if (typeof(setting[1]) == "string" && setting[1].toLowerCase() === "true") setting[1] = true;
|
||||
if (typeof(setting[1]) == "string" && setting[1].toLowerCase() === "false") setting[1] = false;
|
||||
activeState.settings[setting[0]] = setting[1];
|
||||
}
|
||||
}
|
||||
@ -87,7 +89,7 @@ function init() {
|
||||
eventListeners();
|
||||
|
||||
//print current version and storage mode to footer
|
||||
let msg = (activeState.settings.persistentStorage == "false") ? "temporary" : "persistent";
|
||||
let msg = (!activeState.settings.persistentStorage) ? "temporary" : "persistent";
|
||||
printVersion("storage mode: "+msg+" |");
|
||||
|
||||
//adjust title for mobile use
|
||||
|
||||
@ -102,7 +102,7 @@ function parseForm(returnDIV = false) {
|
||||
bHtml = bHtml.replace(/<\/div>/g, '<br />');
|
||||
bHtml = bHtml.replace(/<div>/g, '');
|
||||
|
||||
if (activeState.settings.enablePell == "true") {
|
||||
if (activeState.settings.enablePell) {
|
||||
bHtml = bHtml.replace(/!l /g, "");
|
||||
bHtml = bHtml.replace(/!n /g, "");
|
||||
bHtml = bHtml.replace(/!ls /g, "");
|
||||
@ -250,7 +250,7 @@ function parseForm(returnDIV = false) {
|
||||
if (listFlag && listIndicator == "") listIndicator = " • ";
|
||||
|
||||
//exclude settings if pell is enabled
|
||||
if (activeState.settings.enablePell == "true") listIndicator = "";
|
||||
if (activeState.settings.enablePell) listIndicator = "";
|
||||
|
||||
//handle global linebreak and fit according to indicator according to list indicator
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ function setCookie(cname, cvalue, exdays) {
|
||||
const d = new Date();
|
||||
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
|
||||
let expires = "expires="+d.toUTCString();
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;SameSite=Lax";
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
|
||||
@ -184,7 +184,7 @@ function saveSettings() {
|
||||
//transfer tF
|
||||
if (tF != null) storeData("templateFiles", tF);
|
||||
|
||||
let msg = (activeState.settings.persistentStorage == "false") ? "temporary" : "persistent";
|
||||
let msg = (!activeState.settings.persistentStorage) ? "temporary" : "persistent";
|
||||
printVersion("storage mode: "+msg+" |");
|
||||
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ const tempStore = {
|
||||
};
|
||||
|
||||
function getStor() {
|
||||
if (window.activeState.settings.persistentStorage == "true") {
|
||||
if (window.activeState.settings.persistentStorage) {
|
||||
return window.localStorage;
|
||||
} else {
|
||||
return tempStore;
|
||||
@ -43,6 +43,7 @@ function getStor() {
|
||||
|
||||
function debug(mode, key, data) {
|
||||
if (activeState.settings.debug == "false") return data;
|
||||
if (activeState.settings.debug == false) return data;
|
||||
console.log({
|
||||
mode: mode,
|
||||
key: key,
|
||||
@ -165,7 +166,7 @@ function getFileName() {
|
||||
ts_copy: "",
|
||||
ts_edit: "",
|
||||
id: cyrb53(currentFileName),
|
||||
editor: (activeState.settings.enablePell == "true") ? "pell": "textarea"
|
||||
editor: (activeState.settings.enablePell) ? "pell": "textarea"
|
||||
};
|
||||
|
||||
if (tF.length != 0) {
|
||||
|
||||
@ -291,6 +291,7 @@ function retrieveForm(arr) {
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
|
||||
if (arr[i].name == "") continue;
|
||||
let e = document.getElementById(arr[i].name);
|
||||
if (e === null) {
|
||||
//parse connected list
|
||||
@ -323,9 +324,28 @@ function retrieveForm(arr) {
|
||||
|
||||
switch (e.nodeName) {
|
||||
case "TEXTAREA":
|
||||
|
||||
arr[i].value = arr[i].value.replace(/<div>/g, "");
|
||||
arr[i].value = arr[i].value.replace(/<\/div>/g, "\n");
|
||||
arr[i].value = arr[i].value.replace(/<.{1,4}>/g, "");
|
||||
|
||||
if (e.parentElement != undefined) {
|
||||
if (e.parentElement.getElementsByClassName("pell-content")[0] != undefined) {
|
||||
let contentArray = arr[i].value.split("\n");
|
||||
let parsedContent = "";
|
||||
if (contentArray.length != 0) {
|
||||
for (let contentLine of contentArray) {
|
||||
if (contentLine != "") {
|
||||
contentLine = "<div>" + contentLine + "</div>";
|
||||
}
|
||||
parsedContent += contentLine;
|
||||
}
|
||||
} else {
|
||||
parsedContent = arr[i].value;
|
||||
}
|
||||
e.innerHTML = arr[i].value;
|
||||
|
||||
arr[i].value = parsedContent;
|
||||
e = e.parentElement.getElementsByClassName("pell-content")[0];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user