implemented lineBreak

default 200
This commit is contained in:
maru21 2023-10-01 18:50:46 +02:00
parent 87ec93e209
commit 696c3f97a1
18 changed files with 69 additions and 40 deletions

View File

@ -16,7 +16,7 @@
<link rel="stylesheet" href="css/font-awesome/css/all.min.css" /> <link rel="stylesheet" href="css/font-awesome/css/all.min.css" />
<link rel="stylesheet" href="css/styles.css" /> <link rel="stylesheet" href="css/styles.css" />
<script type="module" src="js/9.7/main.js"></script> <script type="module" src="js/9.8/main.js"></script>
<body> <body>

View File

@ -16,7 +16,7 @@ window.activeState = {
fileName: "", fileName: "",
lastElement: "", lastElement: "",
serverFilesTs: "", serverFilesTs: "",
lineBreak: 80, lineBreak: 200,
templates: [], templates: [],
templateFieldTypes: [ templateFieldTypes: [
"simpleInput", "simpleInput",

View File

@ -173,7 +173,6 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
value = obj.placeholder + "\n" + value; value = obj.placeholder + "\n" + value;
} }
} }
//Plugin TextBlock Insertion according to file _textblocks.txt //Plugin TextBlock Insertion according to file _textblocks.txt
value = parseTextBlocks(value); value = parseTextBlocks(value);
@ -182,6 +181,9 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
//handle placeholders like !l or !n and set it to final interpreted string for object //handle placeholders like !l or !n and set it to final interpreted string for object
value = parseTextMarkups(value); value = parseTextMarkups(value);
//parse global linebreak after marked text was already fixed
value = parseGlobalLineBreak(value);
return value; return value;
} }
@ -317,20 +319,46 @@ function parseFormOnSubmit(returnJSON = false, parseOnly = false) {
return data; return data;
} }
function parseGlobalLineBreak(data) {
let parsedData = '';
for (let line of data.split('\n')) {
let parsedLine = parseLineBreak(line);
if (parsedData != '') {
parsedData = parsedData + '\n' + parsedLine;
} else {
parsedData = parsedLine;
}
}
return parsedData
}
function parseLineBreak(line, intendation = 0) { function parseLineBreak(line, intendation = 0) {
return line;
//very much in development no idea yet //very much in development no idea yet
let lines; let lines;
if (line.length > activeState.lineBreak) { if (line.length > activeState.lineBreak) {
let correctedLineBreak;
let newLineStart;
let cLBt = activeState.lineBreak-(intendation*2)
correctedLineBreak = line.substring(0, cLBt).lastIndexOf(" ");
newLineStart = correctedLineBreak+1;
lines = line.substring(0, correctedLineBreak);
line = line.substring(newLineStart);
while(line.length > activeState.lineBreak) { while(line.length > activeState.lineBreak) {
let intendationSpaces = ''; let intendationSpaces = '';
if (intendation != 0) intendationSpaces = ' '.repeat(intendation); if (intendation != 0) intendationSpaces = ' '.repeat(intendation+1);
let cLBt = activeState.lineBreak-(intendation*2)
lines = lines + "\n" + intendationSpaces + line.substring(0, activeState.lineBreak-intendation); correctedLineBreak = line.substring(0, cLBt).lastIndexOf(" ");
line = line.substring(activeState.lineBreak-intendation); newLineStart = correctedLineBreak+1;
lines += "\n" + intendationSpaces + line.substring(0, correctedLineBreak);
line = line.substring(newLineStart);
break;
} }
let intendationSpaces = '';
if (intendation != 0) intendationSpaces = ' '.repeat(intendation+1);
lines += "\n" + intendationSpaces + line;
} else { } else {
lines = line; lines = line;
} }

63
template/Sozialanamnese.txt Executable file → Normal file
View File

@ -1,31 +1,32 @@
# #
# Erzeuge das Wohnenfeld an erster Stelle und generiere ein Eingabefeld in Listenformat # Erzeuge das Wohnenfeld an erster Stelle und generiere ein Eingabefeld in Listenformat
Wohnen: Wohnen:
!l Lebensmittelpunkt: %Lebensmittelpunkt%10 !l Lebensmittelpunkt: %Lebensmittelpunkt%10
!l Mietzins: %Mietzins CHF%11 !l Mietzins: %Mietzins CHF%11
!l Wohnhaft seit %Wohnhaft seit%12 !l Wohnhaft seit %Wohnhaft seit%12
!l Wohnhaft mit %Wohnpartner%13 !l Wohnhaft mit %Wohnpartner%13
%Weitere Angaben zum Wohnen=longText:!l%15 %Weitere Angaben zum Wohnen=longText:!l%15
Finanzen: Finanzen:
%Finanzielle Situation=longText:!l%20 %Finanzielle Situation=longText:!l%20
Arbeit: Arbeit:
%Arbeitssituation und IV=longText:!l%30 %Arbeitssituation und IV=longText:!l%30
Tagesstruktur: Tagesstruktur:
%Tagesstruktur=longText:!l%40 %Tagesstruktur=longText:!l%40
Soziales Umfeld: Soziales Umfeld:
%Soziales Umfeld=longText:!l%50 %Soziales Umfeld=longText:!l%50
Externe Fachpersonen: Externe Fachpersonen:
%Externe Fachpersonen=longText:!l%60 %Externe Fachpersonen=longText:!l%60
Beistandschaft: Beistandschaft:
%Berufsbeistandschaft vorhanden=simpleInput:!l%70 %Berufsbeistandschaft vorhanden=simpleInput:!l%70
Sozialarbeiter:in: Karim Muhrer Sozialarbeiter:in: Karim Muhrer
Verlauf: Verlauf:
Der Patient wurde durch den internen Sozialdienst beraten. %Verlauf Patient=longText%80 Der Patient wurde durch den internen Sozialdienst beraten.
%Verlauf Patient=longText%80

View File

@ -1 +1 @@
[{"value":"!none","name":"Con_List_Selection"},{"value":"","name":"cl-Die_Patientin_ist_erwerbstätig","placeholder":"!ls"},{"value":"Firma: \nFunktion: \nPensum: \nAngestellt seit: \n","name":"cl-Der_Patient_ist_erwerbstätig_auf_dem_2._AM","placeholder":"!ls"},{"value":"AUF seit: \nAktueller Stand IV: ","name":"cl-_Der_Patient_ist_nicht_erwerbstätig","placeholder":"!ls"},{"value":"","name":"cl-Andere","placeholder":"!ls"},{"value":"Lebensmittelpunkt","name":"Con_List_Button"},{"value":"","name":"cl-Lebensmittelpunkt","placeholder":"!ls"}] [{"value":"!none","name":"Con_List_Selection"},{"value":"","name":"cl-Die_Patientin_ist_erwerbstätig","placeholder":"!ls"},{"value":"Firma: \nFunktion: \nPensum: \nAngestellt seit: \n","name":"cl-Der_Patient_ist_erwerbstätig_auf_dem_2._AM","placeholder":"!ls"},{"value":"AUF seit: \nAktueller Stand IV: ","name":"cl-_Der_Patient_ist_nicht_erwerbstätig","placeholder":"!ls"},{"value":"","name":"cl-Andere","placeholder":"!ls"},{"value":"Lebensmittelpunkt","name":"Con_List_Button"},{"value":"!ls\n!kbs","name":"cl-Lebensmittelpunkt","placeholder":"!ls"}]