solid-panes 3.6.2-eee122ba → 3.6.3-c7f6db53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/outline/index.html +1 -1
- package/coverage/lcov-report/outline/outlineIcons.js.html +1 -1
- package/coverage/lcov-report/outline/propertyViews.ts.html +1 -1
- package/coverage/lcov-report/outline/viewAsImage.ts.html +1 -1
- package/coverage/lcov-report/outline/viewAsMbox.ts.html +1 -1
- package/coverage/lcov-report/trustedApplications/index.html +1 -1
- package/coverage/lcov-report/trustedApplications/trustedApplications.utils.ts.html +1 -1
- package/eslint.config.mjs +34 -0
- package/lib/humanReadablePane.js +33 -31
- package/lib/humanReadablePane.js.map +1 -1
- package/lib/schedule/formsForSchedule.js +5 -1
- package/lib/schedule/formsForSchedule.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/package.json +5 -4
- package/src/humanReadablePane.js +28 -35
- package/src/schedule/formsForSchedule.js +1 -1
- package/src/versionInfo.ts +3 -3
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1739473574993" clover="3.2.0">
|
|
3
|
+
<project timestamp="1739473574994" name="All files">
|
|
4
4
|
<metrics statements="125" coveredstatements="125" conditionals="6" coveredconditionals="4" methods="13" coveredmethods="13" elements="144" coveredelements="142" complexity="0" loc="125" ncloc="125" packages="2" files="5" classes="5"/>
|
|
5
5
|
<package name="outline">
|
|
6
6
|
<metrics statements="112" coveredstatements="112" conditionals="6" coveredconditionals="4" methods="7" coveredmethods="7"/>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2025-02-
|
|
119
|
+
at 2025-02-13T19:06:14.984Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
147
147
|
Code coverage generated by
|
|
148
148
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
149
|
-
at 2025-02-
|
|
149
|
+
at 2025-02-13T19:06:14.984Z
|
|
150
150
|
</div>
|
|
151
151
|
<script src="../prettify.js"></script>
|
|
152
152
|
<script>
|
|
@@ -550,7 +550,7 @@ outlineIcons.termWidgets.addTri = new outlineIcons.OutlinerIcon(
|
|
|
550
550
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
551
551
|
Code coverage generated by
|
|
552
552
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
553
|
-
at 2025-02-
|
|
553
|
+
at 2025-02-13T19:06:14.984Z
|
|
554
554
|
</div>
|
|
555
555
|
<script src="../prettify.js"></script>
|
|
556
556
|
<script>
|
|
@@ -181,7 +181,7 @@ export function viewsAddPropertyView (views, property, pviewfunc, isDefault) {
|
|
|
181
181
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
182
182
|
Code coverage generated by
|
|
183
183
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
184
|
-
at 2025-02-
|
|
184
|
+
at 2025-02-13T19:06:14.984Z
|
|
185
185
|
</div>
|
|
186
186
|
<script src="../prettify.js"></script>
|
|
187
187
|
<script>
|
|
@@ -106,7 +106,7 @@ export default (dom) => function viewAsImage (obj) {
|
|
|
106
106
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
107
107
|
Code coverage generated by
|
|
108
108
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
109
|
-
at 2025-02-
|
|
109
|
+
at 2025-02-13T19:06:14.984Z
|
|
110
110
|
</div>
|
|
111
111
|
<script src="../prettify.js"></script>
|
|
112
112
|
<script>
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
113
113
|
Code coverage generated by
|
|
114
114
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
115
|
-
at 2025-02-
|
|
115
|
+
at 2025-02-13T19:06:14.984Z
|
|
116
116
|
</div>
|
|
117
117
|
<script src="../prettify.js"></script>
|
|
118
118
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2025-02-
|
|
104
|
+
at 2025-02-13T19:06:14.984Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -223,7 +223,7 @@ export function generateRandomString () {
|
|
|
223
223
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
224
224
|
Code coverage generated by
|
|
225
225
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
226
|
-
at 2025-02-
|
|
226
|
+
at 2025-02-13T19:06:14.984Z
|
|
227
227
|
</div>
|
|
228
228
|
<script src="../prettify.js"></script>
|
|
229
229
|
<script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import tsParser from "@typescript-eslint/parser";
|
|
4
|
+
|
|
5
|
+
export default [{
|
|
6
|
+
ignores: ["**/dist", "**/lib", "typings/rdflib"],
|
|
7
|
+
}, {
|
|
8
|
+
plugins: {
|
|
9
|
+
"@typescript-eslint": typescriptEslint,
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.browser,
|
|
15
|
+
...globals.node,
|
|
16
|
+
Atomics: "readonly",
|
|
17
|
+
SharedArrayBuffer: "readonly",
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
parser: tsParser,
|
|
21
|
+
},
|
|
22
|
+
files: ["src/**/*.js", "src/**/*.ts", "src/**/*.cjs", "src/**/*.mjs"],
|
|
23
|
+
rules: {
|
|
24
|
+
"no-unused-vars": ["warn", {
|
|
25
|
+
argsIgnorePattern: "^_",
|
|
26
|
+
varsIgnorePattern: "^_",
|
|
27
|
+
}],
|
|
28
|
+
|
|
29
|
+
"@typescript-eslint/no-unused-vars": ["warn", {
|
|
30
|
+
argsIgnorePattern: "^_",
|
|
31
|
+
varsIgnorePattern: "^_",
|
|
32
|
+
}],
|
|
33
|
+
},
|
|
34
|
+
}];
|
package/lib/humanReadablePane.js
CHANGED
|
@@ -77,7 +77,7 @@ var humanReadablePane = {
|
|
|
77
77
|
frame.setAttribute('src', URL.createObjectURL(blob));
|
|
78
78
|
frame.setAttribute('type', blob.type);
|
|
79
79
|
frame.setAttribute('class', 'doc');
|
|
80
|
-
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width:
|
|
80
|
+
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 800px; resize: both; overflow: auto;"));
|
|
81
81
|
|
|
82
82
|
// Apply sandbox attribute only for HTML files
|
|
83
83
|
// @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
|
|
@@ -88,43 +88,45 @@ var humanReadablePane = {
|
|
|
88
88
|
frame.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var clean = _dompurify["default"].sanitize(res);
|
|
95
|
-
frame.innerHTML = clean;
|
|
96
|
-
frame.setAttribute('class', 'doc');
|
|
97
|
-
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 100%; max-width: 800px; resize: both; overflow: auto;"));
|
|
98
|
-
};
|
|
99
|
-
var fetchAndProcessBlob = function fetchAndProcessBlob(kb, subject, frame) {
|
|
100
|
-
kb.fetcher._fetch(subject.uri).then(function (response) {
|
|
101
|
-
return response.blob();
|
|
102
|
-
}).then(function (blob) {
|
|
103
|
-
var lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\n/).length + 5) : 5;
|
|
104
|
-
setIframeAttributes(frame, blob, lines);
|
|
105
|
-
return blob.type.startsWith('text') ? blob.text() : '';
|
|
106
|
-
}).then(function (blobText) {
|
|
107
|
-
if (blobText) {
|
|
108
|
-
var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
|
|
109
|
-
var lines = Math.min(30, blobText.split(/\n/).length + newLines);
|
|
110
|
-
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 100%; max-width: 800px; resize: both; overflow: auto;"));
|
|
111
|
-
}
|
|
112
|
-
})["catch"](function (error) {
|
|
113
|
-
console.error('Error processing blob:', error);
|
|
114
|
-
frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');
|
|
115
|
-
frame.textContent = 'Error loading content';
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
if (ct === 'text/markdown') {
|
|
91
|
+
|
|
92
|
+
// render markdown to html
|
|
93
|
+
var markdownHtml = function markdownHtml() {
|
|
119
94
|
kb.fetcher.webOperation('GET', subject.uri).then(function (response) {
|
|
120
95
|
var markdownText = response.responseText;
|
|
121
|
-
|
|
96
|
+
var lines = Math.min(30, markdownText.split(/\n/).length + 5);
|
|
97
|
+
var res = _marked.marked.parse(markdownText);
|
|
98
|
+
var clean = _dompurify["default"].sanitize(res);
|
|
99
|
+
frame.innerHTML = clean;
|
|
100
|
+
frame.setAttribute('class', 'doc');
|
|
101
|
+
frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 800px; resize: both; overflow: auto;"));
|
|
122
102
|
})["catch"](function (error) {
|
|
123
103
|
console.error('Error fetching markdown content:', error);
|
|
124
104
|
frame.innerHTML = '<p>Error loading content</p>';
|
|
125
105
|
});
|
|
106
|
+
};
|
|
107
|
+
if (ct === 'text/markdown') {
|
|
108
|
+
markdownHtml();
|
|
126
109
|
} else {
|
|
127
|
-
|
|
110
|
+
// Fetch and process the blob
|
|
111
|
+
kb.fetcher._fetch(subject.uri).then(function (response) {
|
|
112
|
+
return response.blob();
|
|
113
|
+
}).then(function (blob) {
|
|
114
|
+
var blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('');
|
|
115
|
+
return blobTextPromise.then(function (blobText) {
|
|
116
|
+
return {
|
|
117
|
+
blob: blob,
|
|
118
|
+
blobText: blobText
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}).then(function (_ref) {
|
|
122
|
+
var blob = _ref.blob,
|
|
123
|
+
blobText = _ref.blobText;
|
|
124
|
+
var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
|
|
125
|
+
var lines = Math.min(30, blobText.split(/\n/).length + newLines);
|
|
126
|
+
setIframeAttributes(frame, blob, lines);
|
|
127
|
+
})["catch"](function (err) {
|
|
128
|
+
console.log('Error fetching or processing blob:', err);
|
|
129
|
+
});
|
|
128
130
|
}
|
|
129
131
|
var tr = myDocument.createElement('TR');
|
|
130
132
|
tr.appendChild(frame);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"humanReadablePane.js","names":["_solidUi","require","_rdflib","_marked","_dompurify","_interopRequireDefault","e","__esModule","humanReadablePane","icon","icons","originalIconBase","name","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","ns","link","render","myDocument","dom","div","createElement","doc","ct","split","trim","console","log","setAttribute","element","frame","setIframeAttributes","blob","lines","URL","createObjectURL","type","concat","processMarkdown","markdownText","Math","min","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","fetchAndProcessBlob","_fetch","then","response","startsWith","text","blobText","newLines","includes","error","textContent","webOperation","responseText","tr","appendChild","_default","exports"],"sources":["../src/humanReadablePane.js"],"sourcesContent":["/* Human-readable Pane\n **\n ** This outline pane contains the document contents for an HTML document\n ** This is for peeking at a page, because the user might not want to leave the data browser.\n */\nimport { icons, ns } from 'solid-ui'\nimport { Util } from 'rdflib'\nimport { marked } from 'marked'\nimport DOMPurify from 'dompurify';\n\nconst humanReadablePane = {\n icon: icons.originalIconBase + 'tango/22-text-x-generic.png',\n\n name: 'humanReadable',\n\n label: function (subject, context) {\n const kb = context.session.store\n\n // See also the source pane, which has lower precedence.\n\n const allowed = [\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/xhtml+xml',\n 'image/png',\n 'image/jpeg',\n 'application/pdf',\n 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data could come from a fetch OR from ldp container\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(x)\n for (let k = 0; k < displayables.length; k++) {\n if (Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'View'\n }\n\n return null\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0].split(';', 1)[0].trim() : null // remove content-type parameters\n if (ct) {\n // console.log('humanReadablePane: c-t:' + ct)\n } else {\n console.log('humanReadablePane: unknown content-type?')\n }\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME'\n const frame = myDocument.createElement(element)\n\n const setIframeAttributes = (frame, blob, lines) => {\n frame.setAttribute('src', URL.createObjectURL(blob));\n frame.setAttribute('type', blob.type);\n frame.setAttribute('class', 'doc');\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);\n\n // Apply sandbox attribute only for HTML files\n // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can't have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {\n frame.setAttribute('sandbox', 'allow-scripts allow-same-origin');\n }\n };\n\n const processMarkdown = (frame, markdownText) => {\n const lines = Math.min(30, markdownText.split(/\\n/).length + 5);\n const res = marked.parse(markdownText);\n const clean = DOMPurify.sanitize(res);\n frame.innerHTML = clean;\n frame.setAttribute('class', 'doc');\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);\n };\n\n const fetchAndProcessBlob = (kb, subject, frame) => {\n kb.fetcher._fetch(subject.uri)\n .then(response => response.blob())\n .then(blob => {\n const lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\\n/).length + 5) : 5;\n setIframeAttributes(frame, blob, lines);\n return blob.type.startsWith('text') ? blob.text() : '';\n })\n .then(blobText => {\n if (blobText) {\n const newLines = blobText.includes('<script src=\"https://dokie.li/scripts/dokieli.js\">') ? -10 : 5;\n const lines = Math.min(30, blobText.split(/\\n/).length + newLines);\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);\n }\n })\n .catch(error => {\n console.error('Error processing blob:', error);\n frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');\n frame.textContent = 'Error loading content';\n });\n };\n\n if (ct === 'text/markdown') {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n processMarkdown(frame, markdownText);\n }).catch(error => {\n console.error('Error fetching markdown content:', error)\n frame.innerHTML = '<p>Error loading content</p>'\n })\n } else {\n fetchAndProcessBlob(kb, subject, frame);\n }\n\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane\n// ends\n"],"mappings":";;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAkC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AARlC;AACA;AACA;AACA;AACA;;AAMA,IAAME,iBAAiB,GAAG;EACxBC,IAAI,EAAEC,cAAK,CAACC,gBAAgB,GAAG,6BAA6B;EAE5DC,IAAI,EAAE,eAAe;EAErBC,KAAK,EAAE,SAAPA,KAAKA,CAAYC,OAAO,EAAEC,OAAO,EAAE;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAO,CAACC,KAAK;;IAEhC;;IAEA,IAAMC,OAAO,GAAG,CACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB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,EAAES,YAAY,CAAC;MACtC,CAAC,CAAC,SAAM,CAAC,UAAAmB,KAAK,EAAI;QAChBhC,OAAO,CAACgC,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;QACxD5B,KAAK,CAACkB,SAAS,GAAG,8BAA8B;MAClD,CAAC,CAAC;IACJ,CAAC,MAAM;MACLC,mBAAmB,CAACtD,EAAE,EAAEF,OAAO,EAAEqC,KAAK,CAAC;IACzC;IAEA,IAAMgC,EAAE,GAAG5C,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzCyC,EAAE,CAACC,WAAW,CAACjC,KAAK,CAAC;IACrBV,GAAG,CAAC2C,WAAW,CAACD,EAAE,CAAC;IACnB,OAAO1C,GAAG;EACZ;AACF,CAAC;AAAA,IAAA4C,QAAA,GAAAC,OAAA,cAEc9E,iBAAiB,EAChC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"humanReadablePane.js","names":["_solidUi","require","_rdflib","_marked","_dompurify","_interopRequireDefault","e","__esModule","humanReadablePane","icon","icons","originalIconBase","name","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","ns","link","render","myDocument","dom","div","createElement","doc","ct","split","trim","console","log","setAttribute","element","frame","setIframeAttributes","blob","lines","URL","createObjectURL","type","concat","markdownHtml","webOperation","then","response","markdownText","responseText","Math","min","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","error","_fetch","blobTextPromise","startsWith","text","Promise","resolve","blobText","_ref","newLines","includes","err","tr","appendChild","_default","exports"],"sources":["../src/humanReadablePane.js"],"sourcesContent":["/* Human-readable Pane\n **\n ** This outline pane contains the document contents for an HTML document\n ** This is for peeking at a page, because the user might not want to leave the data browser.\n */\nimport { icons, ns } from 'solid-ui'\nimport { Util } from 'rdflib'\nimport { marked } from 'marked'\nimport DOMPurify from 'dompurify';\n\nconst humanReadablePane = {\n icon: icons.originalIconBase + 'tango/22-text-x-generic.png',\n\n name: 'humanReadable',\n\n label: function (subject, context) {\n const kb = context.session.store\n\n // See also the source pane, which has lower precedence.\n\n const allowed = [\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/xhtml+xml',\n 'image/png',\n 'image/jpeg',\n 'application/pdf',\n 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data could come from a fetch OR from ldp container\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(x)\n for (let k = 0; k < displayables.length; k++) {\n if (Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'View'\n }\n\n return null\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0].split(';', 1)[0].trim() : null // remove content-type parameters\n if (ct) {\n // console.log('humanReadablePane: c-t:' + ct)\n } else {\n console.log('humanReadablePane: unknown content-type?')\n }\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME'\n const frame = myDocument.createElement(element)\n\n const setIframeAttributes = (frame, blob, lines) => {\n frame.setAttribute('src', URL.createObjectURL(blob));\n frame.setAttribute('type', blob.type);\n frame.setAttribute('class', 'doc');\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);\n\n // Apply sandbox attribute only for HTML files\n // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can't have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {\n frame.setAttribute('sandbox', 'allow-scripts allow-same-origin');\n }\n };\n\n // render markdown to html\n const markdownHtml = function () {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n const lines = Math.min(30, markdownText.split(/\\n/).length + 5)\n const res = marked.parse(markdownText)\n const clean = DOMPurify.sanitize(res)\n frame.innerHTML = clean\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)\n }).catch(error => {\n console.error('Error fetching markdown content:', error)\n frame.innerHTML = '<p>Error loading content</p>'\n })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else {\n // Fetch and process the blob\n kb.fetcher._fetch(subject.uri)\n .then(response => response.blob())\n .then(blob => {\n const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('')\n return blobTextPromise.then(blobText => ({ blob, blobText }))\n })\n .then(({ blob, blobText }) => {\n const newLines = blobText.includes('<script src=\"https://dokie.li/scripts/dokieli.js\">') ? -10 : 5\n const lines = Math.min(30, blobText.split(/\\n/).length + newLines)\n setIframeAttributes(frame, blob, lines)\n })\n .catch(err => {\n console.log('Error fetching or processing blob:', err)\n })\n }\n\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane\n// ends\n"],"mappings":";;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAkC,S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QAAQ,CAAC,oDAAoD,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;QAClG,IAAM9B,KAAK,GAAGW,IAAI,CAACC,GAAG,CAAC,EAAE,EAAEe,QAAQ,CAACpC,KAAK,CAAC,IAAI,CAAC,CAAClB,MAAM,GAAGwD,QAAQ,CAAC;QAClE/B,mBAAmB,CAACD,KAAK,EAAEE,IAAI,EAAEC,KAAK,CAAC;MACzC,CAAC,CAAC,SACI,CAAC,UAAA+B,GAAG,EAAI;QACZtC,OAAO,CAACC,GAAG,CAAC,oCAAoC,EAAEqC,GAAG,CAAC;MACxD,CAAC,CAAC;IACJ;IAEA,IAAMC,EAAE,GAAG/C,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzC4C,EAAE,CAACC,WAAW,CAACpC,KAAK,CAAC;IACrBV,GAAG,CAAC8C,WAAW,CAACD,EAAE,CAAC;IACnB,OAAO7C,GAAG;EACZ;AACF,CAAC;AAAA,IAAA+C,QAAA,GAAAC,OAAA,cAEcjF,iBAAiB,EAChC","ignoreList":[]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = exports["default"] = "\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n";
|
|
4
8
|
//# sourceMappingURL=formsForSchedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formsForSchedule.js","names":[
|
|
1
|
+
{"version":3,"file":"formsForSchedule.js","names":[],"sources":["../../src/schedule/formsForSchedule.js"],"sourcesContent":["export default `\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n`\n"],"mappings":"","ignoreList":[]}
|
package/lib/versionInfo.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _default = exports["default"] = {
|
|
8
|
-
buildTime: "2025-02-
|
|
9
|
-
commit: "
|
|
8
|
+
buildTime: "2025-02-13T19:06:15Z",
|
|
9
|
+
commit: "c7f6db53b895a4500f6b448ca9f4cb9545b5336e",
|
|
10
10
|
npmInfo: {
|
|
11
|
-
'solid-panes': '3.6.
|
|
11
|
+
'solid-panes': '3.6.3',
|
|
12
12
|
npm: '8.19.4',
|
|
13
13
|
node: '18.20.6',
|
|
14
14
|
acorn: '8.13.0',
|
package/lib/versionInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","acorn","ada","ares","base64","brotli","cjs_module_lexer","cldr","icu","llhttp","modules","napi","nghttp2","nghttp3","ngtcp2","openssl","simdutf","tz","undici","unicode","uv","uvwasi","v8","zlib"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-02-
|
|
1
|
+
{"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","acorn","ada","ares","base64","brotli","cjs_module_lexer","cldr","icu","llhttp","modules","napi","nghttp2","nghttp3","ngtcp2","openssl","simdutf","tz","undici","unicode","uv","uvwasi","v8","zlib"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-02-13T19:06:15Z\",\ncommit: \"c7f6db53b895a4500f6b448ca9f4cb9545b5336e\",\nnpmInfo:\n{\n 'solid-panes': '3.6.3',\n npm: '8.19.4',\n node: '18.20.6',\n acorn: '8.13.0',\n ada: '2.8.0',\n ares: '1.29.0',\n base64: '0.5.2',\n brotli: '1.1.0',\n cjs_module_lexer: '1.2.2',\n cldr: '44.1',\n icu: '74.2',\n llhttp: '6.1.1',\n modules: '108',\n napi: '9',\n nghttp2: '1.61.0',\n nghttp3: '0.7.0',\n ngtcp2: '1.3.0',\n openssl: '3.0.15+quic',\n simdutf: '5.6.0',\n tz: '2024a',\n undici: '5.28.5',\n unicode: '15.1',\n uv: '1.44.2',\n uvwasi: '0.0.19',\n v8: '10.2.154.26-node.37',\n zlib: '1.3.0.1-motley'\n}\n};\n"],"mappings":";;;;;;oCAAe;EACfA,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACP;IACE,aAAa,EAAE,OAAO;IACtBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,QAAQ;IACfC,GAAG,EAAE,OAAO;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,MAAM,EAAE,OAAO;IACfC,gBAAgB,EAAE,OAAO;IACzBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,KAAK;IACdC,IAAI,EAAE,GAAG;IACTC,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,OAAO;IAChBC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,aAAa;IACtBC,OAAO,EAAE,OAAO;IAChBC,EAAE,EAAE,OAAO;IACXC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,MAAM;IACfC,EAAE,EAAE,QAAQ;IACZC,MAAM,EAAE,QAAQ;IAChBC,EAAE,EAAE,qBAAqB;IACzBC,IAAI,EAAE;EACR;AACA,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-panes",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3-c7f6db53",
|
|
4
4
|
"description": "Solid-compatible Panes: applets and views for the mashlib and databrowser",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"chat-pane": "^2.4.27",
|
|
52
52
|
"contacts-pane": "^2.6.13",
|
|
53
53
|
"dompurify": "^3.2.4",
|
|
54
|
+
"eslint": "^9.20.1",
|
|
54
55
|
"folder-pane": "^2.4.28",
|
|
55
56
|
"issue-pane": "^2.4.20",
|
|
56
57
|
"marked": "^11.2.0",
|
|
@@ -70,12 +71,12 @@
|
|
|
70
71
|
"@testing-library/dom": "^9.3.4",
|
|
71
72
|
"@testing-library/jest-dom": "^6.6.3",
|
|
72
73
|
"@types/webpack-env": "^1.18.8",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
74
|
-
"@typescript-eslint/parser": "^
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
75
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
75
76
|
"babel-loader": "^9.2.1",
|
|
76
77
|
"babel-plugin-inline-import": "^3.0.0",
|
|
77
78
|
"buffer": "^6.0.3",
|
|
78
|
-
"
|
|
79
|
+
"globals": "^15.15.0",
|
|
79
80
|
"html-webpack-plugin": "^5.6.3",
|
|
80
81
|
"husky": "^8.0.3",
|
|
81
82
|
"jest": "^29.7.0",
|
package/src/humanReadablePane.js
CHANGED
|
@@ -91,7 +91,7 @@ const humanReadablePane = {
|
|
|
91
91
|
frame.setAttribute('src', URL.createObjectURL(blob));
|
|
92
92
|
frame.setAttribute('type', blob.type);
|
|
93
93
|
frame.setAttribute('class', 'doc');
|
|
94
|
-
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width:
|
|
94
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
|
|
95
95
|
|
|
96
96
|
// Apply sandbox attribute only for HTML files
|
|
97
97
|
// @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
|
|
@@ -103,47 +103,40 @@ const humanReadablePane = {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const res = marked.parse(markdownText);
|
|
109
|
-
const clean = DOMPurify.sanitize(res);
|
|
110
|
-
frame.innerHTML = clean;
|
|
111
|
-
frame.setAttribute('class', 'doc');
|
|
112
|
-
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const fetchAndProcessBlob = (kb, subject, frame) => {
|
|
116
|
-
kb.fetcher._fetch(subject.uri)
|
|
117
|
-
.then(response => response.blob())
|
|
118
|
-
.then(blob => {
|
|
119
|
-
const lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\n/).length + 5) : 5;
|
|
120
|
-
setIframeAttributes(frame, blob, lines);
|
|
121
|
-
return blob.type.startsWith('text') ? blob.text() : '';
|
|
122
|
-
})
|
|
123
|
-
.then(blobText => {
|
|
124
|
-
if (blobText) {
|
|
125
|
-
const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
|
|
126
|
-
const lines = Math.min(30, blobText.split(/\n/).length + newLines);
|
|
127
|
-
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);
|
|
128
|
-
}
|
|
129
|
-
})
|
|
130
|
-
.catch(error => {
|
|
131
|
-
console.error('Error processing blob:', error);
|
|
132
|
-
frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');
|
|
133
|
-
frame.textContent = 'Error loading content';
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
if (ct === 'text/markdown') {
|
|
106
|
+
// render markdown to html
|
|
107
|
+
const markdownHtml = function () {
|
|
138
108
|
kb.fetcher.webOperation('GET', subject.uri).then(response => {
|
|
139
109
|
const markdownText = response.responseText
|
|
140
|
-
|
|
110
|
+
const lines = Math.min(30, markdownText.split(/\n/).length + 5)
|
|
111
|
+
const res = marked.parse(markdownText)
|
|
112
|
+
const clean = DOMPurify.sanitize(res)
|
|
113
|
+
frame.innerHTML = clean
|
|
114
|
+
frame.setAttribute('class', 'doc')
|
|
115
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)
|
|
141
116
|
}).catch(error => {
|
|
142
117
|
console.error('Error fetching markdown content:', error)
|
|
143
118
|
frame.innerHTML = '<p>Error loading content</p>'
|
|
144
119
|
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (ct === 'text/markdown') {
|
|
123
|
+
markdownHtml()
|
|
145
124
|
} else {
|
|
146
|
-
|
|
125
|
+
// Fetch and process the blob
|
|
126
|
+
kb.fetcher._fetch(subject.uri)
|
|
127
|
+
.then(response => response.blob())
|
|
128
|
+
.then(blob => {
|
|
129
|
+
const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('')
|
|
130
|
+
return blobTextPromise.then(blobText => ({ blob, blobText }))
|
|
131
|
+
})
|
|
132
|
+
.then(({ blob, blobText }) => {
|
|
133
|
+
const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5
|
|
134
|
+
const lines = Math.min(30, blobText.split(/\n/).length + newLines)
|
|
135
|
+
setIframeAttributes(frame, blob, lines)
|
|
136
|
+
})
|
|
137
|
+
.catch(err => {
|
|
138
|
+
console.log('Error fetching or processing blob:', err)
|
|
139
|
+
})
|
|
147
140
|
}
|
|
148
141
|
|
|
149
142
|
const tr = myDocument.createElement('TR')
|
package/src/versionInfo.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
buildTime: "2025-02-
|
|
3
|
-
commit: "
|
|
2
|
+
buildTime: "2025-02-13T19:06:15Z",
|
|
3
|
+
commit: "c7f6db53b895a4500f6b448ca9f4cb9545b5336e",
|
|
4
4
|
npmInfo:
|
|
5
5
|
{
|
|
6
|
-
'solid-panes': '3.6.
|
|
6
|
+
'solid-panes': '3.6.3',
|
|
7
7
|
npm: '8.19.4',
|
|
8
8
|
node: '18.20.6',
|
|
9
9
|
acorn: '8.13.0',
|