@difizen/libro-rendermime 0.3.32 → 0.3.34
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-render.d.ts","sourceRoot":"","sources":["../../src/components/text-render.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,cAAc,CAAC;AAWtB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"text-render.d.ts","sourceRoot":"","sources":["../../src/components/text-render.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,cAAc,CAAC;AAWtB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,CAqJ7D,CAAC;AAEF,eAAO,MAAM,UAAU;WAvJuB,cAAc;EAuJT,CAAC"}
|
|
@@ -17,6 +17,7 @@ import { renderText } from "../renderers.js";
|
|
|
17
17
|
import { RenderMimeRegistry } from "../rendermime-registry.js";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
21
|
function getLastThreeAfterFirstTwo(arr) {
|
|
21
22
|
var startIndex = Math.max(2, arr.length - 3);
|
|
22
23
|
return arr.slice(startIndex);
|
|
@@ -58,47 +59,76 @@ export var RawTextRender = function RawTextRender(props) {
|
|
|
58
59
|
}
|
|
59
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
61
|
}, [mimeType, dataContent]);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
onClick: function onClick() {
|
|
77
|
-
model.cell.isLargeOutputDisplay = !model.cell.isLargeOutputDisplay;
|
|
78
|
-
setIsLargeOutputDisplay(!isLargeOutputDisplay);
|
|
79
|
-
},
|
|
80
|
-
className: "libro-text-display-action",
|
|
81
|
-
children: isLargeOutputDisplay ? ' 展开查看' : ' 截断查看'
|
|
82
|
-
}), isLargeOutputDisplay && /*#__PURE__*/_jsxs("span", {
|
|
83
|
-
children: ["\uFF0C\u6216\u5728", /*#__PURE__*/_jsx("a", {
|
|
84
|
-
className: "libro-text-display-action",
|
|
62
|
+
var content = null;
|
|
63
|
+
if (isLargeOutputDisplay) {
|
|
64
|
+
content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
65
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
66
|
+
className: "libro-text-render",
|
|
67
|
+
ref: renderTextRef,
|
|
68
|
+
style: {
|
|
69
|
+
overflowY: 'auto',
|
|
70
|
+
maxHeight: 'unset'
|
|
71
|
+
}
|
|
72
|
+
}), model.raw['display_text'] && /*#__PURE__*/_jsxs("div", {
|
|
73
|
+
className: "libro-text-display-action-container",
|
|
74
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
75
|
+
children: "\u8F93\u51FA\u5DF2\u88AB\u622A\u65AD\uFF0C\u70B9\u51FB\u53EF\u5728\u6EDA\u52A8\u5BB9\u5668\u5185"
|
|
76
|
+
}), /*#__PURE__*/_jsx("a", {
|
|
85
77
|
onClick: function onClick() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
model.cell.isLargeOutputDisplay = !model.cell.isLargeOutputDisplay;
|
|
79
|
+
setIsLargeOutputDisplay(!isLargeOutputDisplay);
|
|
80
|
+
},
|
|
81
|
+
className: "libro-text-display-action",
|
|
82
|
+
children: "\u6EDA\u52A8\u67E5\u770B"
|
|
83
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
84
|
+
children: ["\uFF0C\u6216\u5728", /*#__PURE__*/_jsx("a", {
|
|
85
|
+
className: "libro-text-display-action",
|
|
86
|
+
onClick: function onClick() {
|
|
87
|
+
var mimeType = defaultRenderMime.defaultPreferredMimeType(model, undefined);
|
|
88
|
+
var dataContent = null;
|
|
89
|
+
if (mimeType) {
|
|
90
|
+
dataContent = model.data[mimeType];
|
|
91
|
+
if (dataContent !== null) {
|
|
92
|
+
model.cell.parent.outputRenderTabEmitter.fire({
|
|
93
|
+
mimeType: mimeType,
|
|
94
|
+
data: dataContent || ''
|
|
95
|
+
});
|
|
96
|
+
}
|
|
95
97
|
}
|
|
96
|
-
}
|
|
98
|
+
},
|
|
99
|
+
children: "\u6587\u672C\u7F16\u8F91\u5668"
|
|
100
|
+
}), "\u4E2D\u6253\u5F00"]
|
|
101
|
+
})]
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
106
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
107
|
+
className: "libro-text-render",
|
|
108
|
+
ref: renderTextRef,
|
|
109
|
+
style: {
|
|
110
|
+
overflowY: 'auto',
|
|
111
|
+
maxHeight: '420px'
|
|
112
|
+
}
|
|
113
|
+
}), model.raw['display_text'] && /*#__PURE__*/_jsxs("div", {
|
|
114
|
+
className: "libro-text-display-action-container",
|
|
115
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
116
|
+
children: "\u5F53\u524D\u5904\u4E8E\u6EDA\u52A8\u67E5\u770B\uFF0C\u70B9\u51FB\u53EF"
|
|
117
|
+
}), /*#__PURE__*/_jsx("a", {
|
|
118
|
+
onClick: function onClick() {
|
|
119
|
+
model.cell.isLargeOutputDisplay = !model.cell.isLargeOutputDisplay;
|
|
120
|
+
setIsLargeOutputDisplay(!isLargeOutputDisplay);
|
|
97
121
|
},
|
|
98
|
-
|
|
99
|
-
|
|
122
|
+
className: "libro-text-display-action",
|
|
123
|
+
children: "\u622A\u65AD\u67E5\u770B"
|
|
124
|
+
})]
|
|
100
125
|
})]
|
|
101
|
-
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/_jsx("div", {
|
|
129
|
+
className: "libro-text-render-container",
|
|
130
|
+
ref: renderTextContainerRef,
|
|
131
|
+
children: content
|
|
102
132
|
});
|
|
103
133
|
};
|
|
104
134
|
export var TextRender = /*#__PURE__*/React.memo(RawTextRender);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-rendermime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-common": "^0.3.
|
|
36
|
-
"@difizen/libro-core": "^0.3.
|
|
37
|
-
"@difizen/libro-markdown": "^0.3.
|
|
35
|
+
"@difizen/libro-common": "^0.3.34",
|
|
36
|
+
"@difizen/libro-core": "^0.3.34",
|
|
37
|
+
"@difizen/libro-markdown": "^0.3.34",
|
|
38
38
|
"@difizen/mana-app": "latest",
|
|
39
39
|
"lodash.escape": "^4.0.1"
|
|
40
40
|
},
|
|
@@ -75,29 +75,32 @@ export const RawTextRender: React.FC<{ model: BaseOutputView }> = (props: {
|
|
|
75
75
|
}
|
|
76
76
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
77
|
}, [mimeType, dataContent]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
78
|
+
|
|
79
|
+
let content = null;
|
|
80
|
+
|
|
81
|
+
if (isLargeOutputDisplay) {
|
|
82
|
+
content = (
|
|
83
|
+
<>
|
|
84
|
+
<div
|
|
85
|
+
className="libro-text-render"
|
|
86
|
+
ref={renderTextRef}
|
|
87
|
+
style={{
|
|
88
|
+
overflowY: 'auto',
|
|
89
|
+
maxHeight: 'unset',
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
{model.raw['display_text'] && (
|
|
93
|
+
<div className="libro-text-display-action-container">
|
|
94
|
+
<span>输出已被截断,点击可在滚动容器内</span>
|
|
95
|
+
<a
|
|
96
|
+
onClick={() => {
|
|
97
|
+
model.cell.isLargeOutputDisplay = !model.cell.isLargeOutputDisplay;
|
|
98
|
+
setIsLargeOutputDisplay(!isLargeOutputDisplay);
|
|
99
|
+
}}
|
|
100
|
+
className="libro-text-display-action"
|
|
101
|
+
>
|
|
102
|
+
滚动查看
|
|
103
|
+
</a>
|
|
101
104
|
<span>
|
|
102
105
|
,或在
|
|
103
106
|
<a
|
|
@@ -123,9 +126,42 @@ export const RawTextRender: React.FC<{ model: BaseOutputView }> = (props: {
|
|
|
123
126
|
</a>
|
|
124
127
|
中打开
|
|
125
128
|
</span>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
</>
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
content = (
|
|
135
|
+
<>
|
|
136
|
+
<div
|
|
137
|
+
className="libro-text-render"
|
|
138
|
+
ref={renderTextRef}
|
|
139
|
+
style={{
|
|
140
|
+
overflowY: 'auto',
|
|
141
|
+
maxHeight: '420px',
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
{model.raw['display_text'] && (
|
|
145
|
+
<div className="libro-text-display-action-container">
|
|
146
|
+
<span>当前处于滚动查看,点击可</span>
|
|
147
|
+
<a
|
|
148
|
+
onClick={() => {
|
|
149
|
+
model.cell.isLargeOutputDisplay = !model.cell.isLargeOutputDisplay;
|
|
150
|
+
setIsLargeOutputDisplay(!isLargeOutputDisplay);
|
|
151
|
+
}}
|
|
152
|
+
className="libro-text-display-action"
|
|
153
|
+
>
|
|
154
|
+
截断查看
|
|
155
|
+
</a>
|
|
156
|
+
</div>
|
|
157
|
+
)}
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<div className="libro-text-render-container" ref={renderTextContainerRef}>
|
|
164
|
+
{content}
|
|
129
165
|
</div>
|
|
130
166
|
);
|
|
131
167
|
};
|