@instructure/ui-source-code-editor 8.53.3-snapshot-5 → 8.53.3-snapshot-8
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/CHANGELOG.md +2 -5
- package/es/SourceCodeEditor/SearchPanel.js +13 -13
- package/lib/SourceCodeEditor/SearchPanel.js +15 -16
- package/package.json +18 -18
- package/src/SourceCodeEditor/SearchPanel.tsx +10 -15
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/SearchPanel.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.53.3-snapshot-
|
|
6
|
+
## [8.53.3-snapshot-8](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-8) (2024-02-23)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* **ui-source-code-editor:** make search panel work with older react versions ([a9b1f1a](https://github.com/instructure/instructure-ui/commit/a9b1f1ab5dd620cc93a59909d395387537e16895))
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-source-code-editor
|
|
12
9
|
|
|
13
10
|
|
|
14
11
|
|
|
@@ -29,7 +29,12 @@ import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearc
|
|
|
29
29
|
import { TextInput } from '@instructure/ui-text-input';
|
|
30
30
|
import { IconButton } from '@instructure/ui-buttons';
|
|
31
31
|
import { IconArrowOpenDownLine, IconArrowOpenUpLine, IconSearchLine } from '@instructure/ui-icons';
|
|
32
|
-
|
|
32
|
+
let reactdom;
|
|
33
|
+
try {
|
|
34
|
+
reactdom = require('react-dom/client');
|
|
35
|
+
} catch {
|
|
36
|
+
reactdom = require('react-dom');
|
|
37
|
+
}
|
|
33
38
|
function SearchPanel({
|
|
34
39
|
view,
|
|
35
40
|
searchConfig
|
|
@@ -95,21 +100,16 @@ function SearchPanel({
|
|
|
95
100
|
export default function customSearch(searchConfig) {
|
|
96
101
|
return searchConfig ? search({
|
|
97
102
|
createPanel: view => {
|
|
98
|
-
var _SearchPanel;
|
|
99
103
|
const dom = document.createElement('div');
|
|
100
104
|
dom.style.padding = '8px';
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
view: view,
|
|
108
|
-
searchConfig: searchConfig
|
|
109
|
-
})));
|
|
110
|
-
}).catch(e => {});
|
|
105
|
+
if ('createRoot' in reactdom) {
|
|
106
|
+
const root = reactdom.createRoot(dom);
|
|
107
|
+
root.render( /*#__PURE__*/React.createElement(SearchPanel, {
|
|
108
|
+
view: view,
|
|
109
|
+
searchConfig: searchConfig
|
|
110
|
+
}));
|
|
111
111
|
} else {
|
|
112
|
-
|
|
112
|
+
reactdom.render( /*#__PURE__*/React.createElement(SearchPanel, {
|
|
113
113
|
view: view,
|
|
114
114
|
searchConfig: searchConfig
|
|
115
115
|
}), dom);
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = customSearch;
|
|
9
|
-
var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));
|
|
10
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _search = require("@codemirror/search");
|
|
13
12
|
var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
|
|
14
13
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
15
14
|
var _IconArrowOpenDownLine = require("@instructure/ui-icons/lib/IconArrowOpenDownLine.js");
|
|
16
15
|
var _IconArrowOpenUpLine2 = require("@instructure/ui-icons/lib/IconArrowOpenUpLine.js");
|
|
17
16
|
var _IconSearchLine2 = require("@instructure/ui-icons/lib/IconSearchLine.js");
|
|
18
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
19
17
|
var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
20
18
|
/*
|
|
21
19
|
* The MIT License (MIT)
|
|
@@ -40,6 +38,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
40
38
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
39
|
* SOFTWARE.
|
|
42
40
|
*/
|
|
41
|
+
let reactdom;
|
|
42
|
+
try {
|
|
43
|
+
reactdom = require('react-dom/client');
|
|
44
|
+
} catch {
|
|
45
|
+
reactdom = require('react-dom');
|
|
46
|
+
}
|
|
43
47
|
function SearchPanel({
|
|
44
48
|
view,
|
|
45
49
|
searchConfig
|
|
@@ -105,21 +109,16 @@ function SearchPanel({
|
|
|
105
109
|
function customSearch(searchConfig) {
|
|
106
110
|
return searchConfig ? (0, _search.search)({
|
|
107
111
|
createPanel: view => {
|
|
108
|
-
var _SearchPanel;
|
|
109
112
|
const dom = document.createElement('div');
|
|
110
113
|
dom.style.padding = '8px';
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
view: view,
|
|
118
|
-
searchConfig: searchConfig
|
|
119
|
-
})));
|
|
120
|
-
}).catch(e => {});
|
|
114
|
+
if ('createRoot' in reactdom) {
|
|
115
|
+
const root = reactdom.createRoot(dom);
|
|
116
|
+
root.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
117
|
+
view: view,
|
|
118
|
+
searchConfig: searchConfig
|
|
119
|
+
}));
|
|
121
120
|
} else {
|
|
122
|
-
|
|
121
|
+
reactdom.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
123
122
|
view: view,
|
|
124
123
|
searchConfig: searchConfig
|
|
125
124
|
}), dom);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "8.53.3-snapshot-
|
|
3
|
+
"version": "8.53.3-snapshot-8",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.53.3-snapshot-
|
|
27
|
-
"@instructure/ui-test-queries": "8.53.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-utils": "8.53.3-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.3-snapshot-8",
|
|
27
|
+
"@instructure/ui-test-queries": "8.53.3-snapshot-8",
|
|
28
|
+
"@instructure/ui-test-utils": "8.53.3-snapshot-8",
|
|
29
29
|
"@testing-library/jest-dom": "^6.1.4",
|
|
30
30
|
"@testing-library/react": "^14.0.0"
|
|
31
31
|
},
|
|
@@ -44,20 +44,20 @@
|
|
|
44
44
|
"@codemirror/search": "^6.5.4",
|
|
45
45
|
"@codemirror/state": "^6.3.0",
|
|
46
46
|
"@codemirror/view": "^6.21.3",
|
|
47
|
-
"@instructure/emotion": "8.53.3-snapshot-
|
|
48
|
-
"@instructure/shared-types": "8.53.3-snapshot-
|
|
49
|
-
"@instructure/ui-a11y-content": "8.53.3-snapshot-
|
|
50
|
-
"@instructure/ui-buttons": "8.53.3-snapshot-
|
|
51
|
-
"@instructure/ui-dom-utils": "8.53.3-snapshot-
|
|
52
|
-
"@instructure/ui-i18n": "8.53.3-snapshot-
|
|
53
|
-
"@instructure/ui-icons": "8.53.3-snapshot-
|
|
54
|
-
"@instructure/ui-prop-types": "8.53.3-snapshot-
|
|
55
|
-
"@instructure/ui-react-utils": "8.53.3-snapshot-
|
|
56
|
-
"@instructure/ui-test-locator": "8.53.3-snapshot-
|
|
57
|
-
"@instructure/ui-testable": "8.53.3-snapshot-
|
|
58
|
-
"@instructure/ui-text-input": "8.53.3-snapshot-
|
|
59
|
-
"@instructure/ui-themes": "8.53.3-snapshot-
|
|
60
|
-
"@instructure/ui-utils": "8.53.3-snapshot-
|
|
47
|
+
"@instructure/emotion": "8.53.3-snapshot-8",
|
|
48
|
+
"@instructure/shared-types": "8.53.3-snapshot-8",
|
|
49
|
+
"@instructure/ui-a11y-content": "8.53.3-snapshot-8",
|
|
50
|
+
"@instructure/ui-buttons": "8.53.3-snapshot-8",
|
|
51
|
+
"@instructure/ui-dom-utils": "8.53.3-snapshot-8",
|
|
52
|
+
"@instructure/ui-i18n": "8.53.3-snapshot-8",
|
|
53
|
+
"@instructure/ui-icons": "8.53.3-snapshot-8",
|
|
54
|
+
"@instructure/ui-prop-types": "8.53.3-snapshot-8",
|
|
55
|
+
"@instructure/ui-react-utils": "8.53.3-snapshot-8",
|
|
56
|
+
"@instructure/ui-test-locator": "8.53.3-snapshot-8",
|
|
57
|
+
"@instructure/ui-testable": "8.53.3-snapshot-8",
|
|
58
|
+
"@instructure/ui-text-input": "8.53.3-snapshot-8",
|
|
59
|
+
"@instructure/ui-themes": "8.53.3-snapshot-8",
|
|
60
|
+
"@instructure/ui-utils": "8.53.3-snapshot-8",
|
|
61
61
|
"@lezer/highlight": "1.1.6",
|
|
62
62
|
"prop-types": "^15.8.1"
|
|
63
63
|
},
|
|
@@ -40,7 +40,12 @@ import {
|
|
|
40
40
|
IconSearchLine
|
|
41
41
|
} from '@instructure/ui-icons'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
let reactdom: any
|
|
44
|
+
try {
|
|
45
|
+
reactdom = require('react-dom/client')
|
|
46
|
+
} catch {
|
|
47
|
+
reactdom = require('react-dom')
|
|
48
|
+
}
|
|
44
49
|
|
|
45
50
|
export type SearchConfig = {
|
|
46
51
|
placeholder: string
|
|
@@ -139,21 +144,11 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
139
144
|
createPanel: (view) => {
|
|
140
145
|
const dom = document.createElement('div')
|
|
141
146
|
dom.style.padding = '8px'
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
import(/* webpackIgnore: true */ 'react-dom/client')
|
|
146
|
-
.then((r) => {
|
|
147
|
-
const root = r.createRoot(dom)
|
|
148
|
-
root.render(
|
|
149
|
-
<SearchPanel view={view} searchConfig={searchConfig} />
|
|
150
|
-
)
|
|
151
|
-
})
|
|
152
|
-
.catch((e) => {
|
|
153
|
-
console.error(e)
|
|
154
|
-
})
|
|
147
|
+
if ('createRoot' in reactdom) {
|
|
148
|
+
const root = reactdom.createRoot(dom)
|
|
149
|
+
root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
|
|
155
150
|
} else {
|
|
156
|
-
|
|
151
|
+
reactdom.render(
|
|
157
152
|
<SearchPanel view={view} searchConfig={searchConfig} />,
|
|
158
153
|
dom
|
|
159
154
|
)
|