Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow textareas to be used in jinjafx_input #74

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## CHANGELOG

### [25.5.4] - Feb 21, 2025
- Actually fixed issue #72 properly this time as we now deal with multi-line strings

### [25.5.3] - Feb 21, 2025
- Fixed issue #72 - `textarea` Inputs Not Recognized in Custom JinjaFx Input Forms

Expand Down Expand Up @@ -416,6 +419,7 @@
- Initial release


[25.5.4]: https://github.com/cmason3/jinjafx_server/compare/25.5.3...25.5.4
[25.5.3]: https://github.com/cmason3/jinjafx_server/compare/25.5.2...25.5.3
[25.5.2]: https://github.com/cmason3/jinjafx_server/compare/25.5.1...25.5.2
[25.5.1]: https://github.com/cmason3/jinjafx_server/compare/25.5.0...25.5.1
Expand Down
2 changes: 1 addition & 1 deletion jinjafx_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess
import cmarkgfm, emoji

__version__ = '25.5.3'
__version__ = '25.5.4'

llock = threading.RLock()
rlock = threading.RLock()
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js" integrity="sha512-CSBhVREyzHAjAFfBlIBakjoRUKp5h7VSweP0InR/pAJyptH7peuhCsqAI/snV+TwZmXZqoUklpXp6R6wMnYf5Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.13/dayjs.min.js" integrity="sha512-FwNWaxyfy2XlEINoSnZh1JQ5TRRtGow0D6XcmAWmYCRgvqOUTnzCxPc9uF35u5ZEpirk1uhlPVA19tflhvnW1g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.13/plugin/relativeTime.min.js" integrity="sha512-MVzDPmm7QZ8PhEiqJXKz/zw2HJuv61waxb8XXuZMMs9b+an3LoqOqhOEt5Nq3LY1e4Ipbbd/e+AWgERdHlVgaA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="/f15b2e54/jinjafx_m.js"></script>
<script src="/97b58eeb/jinjafx_m.js"></script>
</head>
<body>
<div id="overlay"></div>
Expand Down
32 changes: 22 additions & 10 deletions www/jinjafx_m.js
Original file line number Diff line number Diff line change
Expand Up @@ -1470,28 +1470,40 @@ function getStatusText(code) {
if ((e.tagName == 'INPUT') && ((e.type == 'checkbox') || (e.type == 'radio'))) {
v = e.checked;
}
if (vars.hasOwnProperty(e.dataset.var)) {
vars[e.dataset.var].push(v);
if (e.tagName == 'TEXTAREA') {
vars[e.dataset.var] = '|2\n' + v.split(/\r?\n/g).map(function (e) {
return ' ' + e;
}).join('\r\n');
}
else {
vars[e.dataset.var] = [v];
if (vars.hasOwnProperty(e.dataset.var)) {
vars[e.dataset.var].push(v);
}
else {
vars[e.dataset.var] = [v];
}
}
}
}
});

var vars_yml = 'jinjafx_input:\r\n';
Object.keys(vars).forEach(function(v) {
for (i = 0; i < vars[v].length; i++) {
if (typeof vars[v][i] !== "boolean") {
vars[v][i] = '"' + vars[v][i].replace(/"/g, '\\x22') + '"';
if (Array.isArray(vars[v])) {
for (i = 0; i < vars[v].length; i++) {
if (typeof vars[v][i] !== "boolean") {
vars[v][i] = '"' + vars[v][i].replace(/"/g, '\\x22') + '"';
}
}
if (vars[v].length > 1) {
vars_yml += ' ' + v + ': [' + vars[v].join(', ') + ']\r\n';
}
else {
vars_yml += ' ' + v + ': ' + vars[v][0] + '\r\n';
}
}
if (vars[v].length > 1) {
vars_yml += ' ' + v + ': [' + vars[v].join(', ') + ']\r\n';
}
else {
vars_yml += ' ' + v + ': ' + vars[v][0] + '\r\n';
vars_yml += ' ' + v + ': ' + vars[v];
}
});
dt.vars += '\r\n' + vars_yml;
Expand Down
Loading