fixed pells div newline

cleaned some console.logs
This commit is contained in:
maru21 2023-11-02 19:36:42 +01:00
parent 7a48cf0a63
commit 1f008a22a8
6 changed files with 24 additions and 14 deletions

View File

@ -1,4 +1,4 @@
import { sanitize, getCurrentDate } from "./scripts.js";
import { sanitize } from "./scripts.js";
import { storeData, clearData, retrieveData } from "./storage.js";
function parseFormOnSubmit(returnJSON = false, parseOnly = false) {

View File

@ -1,6 +1,5 @@
import { getFileName } from "./storage.js";
import pell from "./pell.js"
import { inputRead } from "./scripts.js";
function transformTemplateObject(objects) {
let form = document.createElement("FORM");
@ -414,7 +413,7 @@ function buildLongTextInput(source, textarea, label) {
const editor = pell.init({
element: source,
defaultParagraphSeparator: "br",
defaultParagraphSeparator: "div",
actions: [
"bold",
"italic",

View File

@ -356,7 +356,6 @@ function formEvts(storageName) {
modalNotifier(activeState.fileName + " copied to clipboard", activeState.settings.notifierPause);
break;
case "Delete":
console.log(storageName);
let previousFile = getPreviousFile(storageName);
clearFileData(storageName);
let delFileName = activeState.fileName;

View File

@ -154,7 +154,7 @@ function eventListeners() {
parseFormOnSubmit();
modalNotifier("File copied to clipboard", activeState.settings.notifierPause);
let copyButton = document.getElementById("fromCopyBtn");
copyButton.className.replace(" w3-grey", " w3-flat-carrot");
copyButton.className = "w3-button w3-flat-carrot";
copyButton.value = "Copied";
e.preventDefault();
}
@ -177,8 +177,6 @@ function eventListeners() {
}
}
}
console.log(template);
});
}

View File

@ -1,4 +1,4 @@
import { sanitize, getCurrentDate } from "./scripts.js";
import { sanitize } from "./scripts.js";
import { storeData, clearData, retrieveData } from "./storage.js";
function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
@ -120,10 +120,21 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
}
}
let bHtml = b.replace(/(?:\r\n|\r|\n)/g, "<br>");
bHtml = bHtml.replace(/!l /g, " • ");
bHtml = bHtml.replace(/!ls /g, " ○ ");
//sanitizing
let bHtml = b;
bHtml = bHtml.replace(/ /g, "&nbsp;");
bHtml = bHtml.replace(/(?:\r\n|\r|\n)/g, "<br />");
bHtml = bHtml.replace(/<\/div>/g, '<br />');
bHtml = bHtml.replace(/<div>/g, '');
if (activeState.settings.enablePell == "true") {
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, " ○ ");
}
let divContent = document.createElement("div");
divContent.style.fontFamily = activeState.settings.font + ", Helvetica, sans-serif";
@ -268,6 +279,9 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
if (listSubFlag && listIndicator == "") listIndicator = " ○ ";
if (listFlag && listIndicator == "") listIndicator = " • ";
//exclude settings if pell is enabled
if (activeState.settings.enablePell == "true") listIndicator = "";
//handle global linebreak and fit according to indicator according to list indicator

View File

@ -61,15 +61,15 @@ function createStorageObj() {
activeState.fileName = userFileNamePH;
}
storeData("userInput", dataArray, "save");
storeData("userInput", dataArray);
}
function storeData(name, data, ref) {
function storeData(name, data) {
if (passwordHash == "") return;
data = JSON.stringify(data);
//setCookie(name, btoa(data), 7);
if (name == "userInput") {
name = getFileName(ref);
name = getFileName();
}
if (name == "userInputForce") {
name = "userInput";