@lyhue1991/dsh-soup 0.4.6 → 0.4.7
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/lib/client.js +21 -4
- package/lib/client.js.map +2 -2
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -21,7 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/client/index.ts
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
|
-
apply: () => apply
|
|
24
|
+
apply: () => apply,
|
|
25
|
+
inject: () => inject
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
|
|
@@ -158,6 +159,22 @@ var DICT = {
|
|
|
158
159
|
|
|
159
160
|
// src/client/plugin.ts
|
|
160
161
|
var React = require("react");
|
|
162
|
+
var create = React.createElement;
|
|
163
|
+
var MarkdownText = null;
|
|
164
|
+
var CodeBlock = null;
|
|
165
|
+
try {
|
|
166
|
+
const uiPrim = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
167
|
+
const cand = uiPrim && uiPrim.MarkdownText;
|
|
168
|
+
if (cand) MarkdownText = cand;
|
|
169
|
+
const candBlock = uiPrim && uiPrim.CodeBlock;
|
|
170
|
+
if (candBlock) CodeBlock = candBlock;
|
|
171
|
+
} catch (err) {
|
|
172
|
+
try {
|
|
173
|
+
globalThis.__DSH_TREE_REQ_ERR = "require threw: " + String(err && err.message || err);
|
|
174
|
+
} catch (_) {
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
var inject = ["slots", "layout", "timer", "sessions", "locale", "remote", "remote.goals"];
|
|
161
178
|
var T = function(key, params) {
|
|
162
179
|
return key;
|
|
163
180
|
};
|
|
@@ -1868,11 +1885,11 @@ function MarkdownPreview(props) {
|
|
|
1868
1885
|
function HtmlPreview(props) {
|
|
1869
1886
|
var text = props.text || "";
|
|
1870
1887
|
if (text.indexOf("js_content") !== -1 || text.indexOf("data-src=") !== -1) {
|
|
1871
|
-
var
|
|
1888
|
+
var inject2 = "<style>#js_content{visibility:visible!important;opacity:1!important;}</style>";
|
|
1872
1889
|
if (/<\/head>/i.test(text)) {
|
|
1873
|
-
text = text.replace(/<\/head>/i,
|
|
1890
|
+
text = text.replace(/<\/head>/i, inject2 + "</head>");
|
|
1874
1891
|
} else {
|
|
1875
|
-
text =
|
|
1892
|
+
text = inject2 + text;
|
|
1876
1893
|
}
|
|
1877
1894
|
text = text.replace(/(<img\b[^>]*?)\sdata-src=/gi, "$1 src=");
|
|
1878
1895
|
}
|