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