fixed conversion error with pell
This commit is contained in:
parent
5eb216f395
commit
0a58816d4b
@ -438,11 +438,11 @@ function buildLongTextInput(source, textarea, label) {
|
|||||||
"paragraph",
|
"paragraph",
|
||||||
"heading1",
|
"heading1",
|
||||||
"heading2",
|
"heading2",
|
||||||
{
|
//{
|
||||||
name: 'ulist',
|
// name: 'ulist',
|
||||||
icon: '<b>•</b>'
|
// icon: '<b>•</b>'
|
||||||
},
|
//},
|
||||||
"olist"
|
//"olist"
|
||||||
],
|
],
|
||||||
onChange: function (html) {
|
onChange: function (html) {
|
||||||
//correct lastElement
|
//correct lastElement
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import setPassword, {
|
|||||||
inputRead
|
inputRead
|
||||||
} from "./scripts.js";
|
} from "./scripts.js";
|
||||||
import parseForm from "./parseForm.js";
|
import parseForm from "./parseForm.js";
|
||||||
import { createStorageObj, storeSettings } from "./storage.js";
|
import { createStorageObj, retrieveData, storeSettings } from "./storage.js";
|
||||||
import { loadNavBar, initTextBlocks, loadNewTemplate } from "./web.js";
|
import { loadNavBar, initTextBlocks, loadNewTemplate } from "./web.js";
|
||||||
|
|
||||||
window.activeState = {
|
window.activeState = {
|
||||||
@ -89,7 +89,7 @@ function init() {
|
|||||||
eventListeners();
|
eventListeners();
|
||||||
|
|
||||||
//print current version and storage mode to footer
|
//print current version and storage mode to footer
|
||||||
let msg = (!activeState.settings.persistentStorage) ? "temporary" : "persistent";
|
let msg = (activeState.settings.persistentStorage) ? "persistent" : "temporary";
|
||||||
printVersion("storage mode: "+msg+" |");
|
printVersion("storage mode: "+msg+" |");
|
||||||
|
|
||||||
//adjust title for mobile use
|
//adjust title for mobile use
|
||||||
@ -98,9 +98,9 @@ function init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//backup landing page
|
//backup landing page
|
||||||
activeState.orgPage.sidebar = document.getElementById("sidebar");
|
activeState.orgPage.sidebar = document.getElementById("sidebar").childNodes;
|
||||||
|
|
||||||
activeState.orgPage.main = document.getElementById("mainForm");
|
activeState.orgPage.main = document.getElementById("mainForm").childNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventListeners() {
|
function eventListeners() {
|
||||||
|
|||||||
@ -97,20 +97,30 @@ function parseForm(returnDIV = false) {
|
|||||||
|
|
||||||
//sanitizing final output string
|
//sanitizing final output string
|
||||||
let bHtml = b;
|
let bHtml = b;
|
||||||
|
|
||||||
|
//remove newline
|
||||||
|
bHtml = bHtml.replace(/!\w{1,2}\n/g, "");
|
||||||
|
|
||||||
|
bHtml = bHtml.replace(/!l /g, " • ");
|
||||||
|
bHtml = bHtml.replace(/!ls /g, " ○ ");
|
||||||
bHtml = bHtml.replace(/ /g, " ");
|
bHtml = bHtml.replace(/ /g, " ");
|
||||||
bHtml = bHtml.replace(/(?:\r\n|\r|\n)/g, "<br />");
|
bHtml = bHtml.replace(/(?:\r\n|\r|\n)/g, "<br />");
|
||||||
|
|
||||||
|
|
||||||
bHtml = bHtml.replace(/<\/div>/g, '<br />');
|
bHtml = bHtml.replace(/<\/div>/g, '<br />');
|
||||||
bHtml = bHtml.replace(/<div>/g, '');
|
bHtml = bHtml.replace(/<div>/g, '');
|
||||||
|
|
||||||
if (activeState.settings.enablePell) {
|
/* if (activeState.settings.enablePell) {
|
||||||
bHtml = bHtml.replace(/!l /g, "");
|
bHtml = bHtml.replace(/!l /g, "");
|
||||||
bHtml = bHtml.replace(/!n /g, "");
|
bHtml = bHtml.replace(/!n /g, "");
|
||||||
bHtml = bHtml.replace(/!ls /g, "");
|
bHtml = bHtml.replace(/!ls /g, "");
|
||||||
} else {
|
} else {
|
||||||
bHtml = bHtml.replace(/!l /g, " • ");
|
bHtml = bHtml.replace(/!l /g, " • ");
|
||||||
bHtml = bHtml.replace(/!ls /g, " ○ ");
|
bHtml = bHtml.replace(/!ls /g, " ○ ");
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//creating output div
|
//creating output div
|
||||||
let divContent = document.createElement("div");
|
let divContent = document.createElement("div");
|
||||||
divContent.style.fontFamily = activeState.settings.font + ", Helvetica, sans-serif";
|
divContent.style.fontFamily = activeState.settings.font + ", Helvetica, sans-serif";
|
||||||
@ -250,7 +260,7 @@ function parseForm(returnDIV = false) {
|
|||||||
if (listFlag && listIndicator == "") listIndicator = " • ";
|
if (listFlag && listIndicator == "") listIndicator = " • ";
|
||||||
|
|
||||||
//exclude settings if pell is enabled
|
//exclude settings if pell is enabled
|
||||||
if (activeState.settings.enablePell) listIndicator = "";
|
//if (activeState.settings.enablePell) listIndicator = "";
|
||||||
|
|
||||||
//handle global linebreak and fit according to indicator according to list indicator
|
//handle global linebreak and fit according to indicator according to list indicator
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,11 @@ const store = {
|
|||||||
getStor().setItem(sha256(key + activeState.userId), data);
|
getStor().setItem(sha256(key + activeState.userId), data);
|
||||||
},
|
},
|
||||||
removeItem: function (key) {
|
removeItem: function (key) {
|
||||||
|
debug("REMOVE", key);
|
||||||
getStor().removeItem(sha256(key + activeState.userId));
|
getStor().removeItem(sha256(key + activeState.userId));
|
||||||
},
|
},
|
||||||
clear: function () {
|
clear: function () {
|
||||||
|
debug("CLEARALL", "");
|
||||||
getStor().clear();
|
getStor().clear();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -60,18 +62,21 @@ function createStorageObj(ref = "none") {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < x.length; i++) {
|
for (let i = 0; i < x.length; i++) {
|
||||||
|
if (x.elements[i].name == "") continue;
|
||||||
|
|
||||||
dataArray.push({
|
dataArray.push({
|
||||||
value: x.elements[i].value,
|
value: x.elements[i].value,
|
||||||
name: x.elements[i].name,
|
name: x.elements[i].name,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(this, dataArray);
|
|
||||||
//set current filename according to filenamefield
|
//set current filename according to filenamefield
|
||||||
setCurrentFileName();
|
setCurrentFileName();
|
||||||
|
|
||||||
//set savetime in templateFiles
|
//set savetime in templateFiles
|
||||||
setTimeStamp(ref);
|
setTimeStamp(ref);
|
||||||
|
|
||||||
|
//store files with preset filename
|
||||||
storeData("userInput", dataArray);
|
storeData("userInput", dataArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +330,6 @@ function setTimeStamp(type) {
|
|||||||
tF[c].metadata.ts_save = getCurrentDate();
|
tF[c].metadata.ts_save = getCurrentDate();
|
||||||
break;
|
break;
|
||||||
case "copy":
|
case "copy":
|
||||||
console.log("copy");
|
|
||||||
tF[c].metadata.ts_copy = getCurrentDate();
|
tF[c].metadata.ts_copy = getCurrentDate();
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
|
|||||||
@ -325,10 +325,12 @@ function retrieveForm(arr) {
|
|||||||
switch (e.nodeName) {
|
switch (e.nodeName) {
|
||||||
case "TEXTAREA":
|
case "TEXTAREA":
|
||||||
|
|
||||||
|
//clean pell attributes for raw input in textarea
|
||||||
arr[i].value = arr[i].value.replace(/<div>/g, "");
|
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(/<\/div>/g, "\n");
|
||||||
arr[i].value = arr[i].value.replace(/<.{1,4}>/g, "");
|
arr[i].value = arr[i].value.replace(/<.{1,4}>/g, "");
|
||||||
|
|
||||||
|
//check if pell was used
|
||||||
if (e.parentElement != undefined) {
|
if (e.parentElement != undefined) {
|
||||||
if (e.parentElement.getElementsByClassName("pell-content")[0] != undefined) {
|
if (e.parentElement.getElementsByClassName("pell-content")[0] != undefined) {
|
||||||
let contentArray = arr[i].value.split("\n");
|
let contentArray = arr[i].value.split("\n");
|
||||||
@ -349,6 +351,8 @@ function retrieveForm(arr) {
|
|||||||
e = e.parentElement.getElementsByClassName("pell-content")[0];
|
e = e.parentElement.getElementsByClassName("pell-content")[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//append raw input to textarea or parsed content to pell content
|
||||||
e.innerHTML = arr[i].value;
|
e.innerHTML = arr[i].value;
|
||||||
break;
|
break;
|
||||||
case "INPUT":
|
case "INPUT":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user