@instructure/ui-source-code-editor 8.53.1 → 8.53.2
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 +11 -0
- package/es/SourceCodeEditor/SearchPanel.js +18 -6
- package/lib/SourceCodeEditor/SearchPanel.js +18 -6
- package/package.json +21 -21
- package/src/SourceCodeEditor/SearchPanel.tsx +16 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SourceCodeEditor/SearchPanel.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.2](https://github.com/instructure/instructure-ui/compare/v8.53.1...v8.53.2) (2024-02-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-source-code-editor:** make search panel react version agnostic ([f917e20](https://github.com/instructure/instructure-ui/commit/f917e20c588d93a30e0681a5c0b1a42e262f7d3e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [8.53.1](https://github.com/instructure/instructure-ui/compare/v8.53.0...v8.53.1) (2024-02-09)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -25,11 +25,16 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import React, { useState } from 'react';
|
|
28
|
-
import { createRoot } from 'react-dom/client';
|
|
29
28
|
import { setSearchQuery, search, findNext, findPrevious, SearchQuery, closeSearchPanel } from '@codemirror/search';
|
|
30
29
|
import { TextInput } from '@instructure/ui-text-input';
|
|
31
30
|
import { IconButton } from '@instructure/ui-buttons';
|
|
32
31
|
import { IconArrowOpenDownLine, IconArrowOpenUpLine, IconSearchLine } from '@instructure/ui-icons';
|
|
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
|
|
@@ -97,11 +102,18 @@ export default function customSearch(searchConfig) {
|
|
|
97
102
|
createPanel: view => {
|
|
98
103
|
const dom = document.createElement('div');
|
|
99
104
|
dom.style.padding = '8px';
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
+
} else {
|
|
112
|
+
reactdom.render( /*#__PURE__*/React.createElement(SearchPanel, {
|
|
113
|
+
view: view,
|
|
114
|
+
searchConfig: searchConfig
|
|
115
|
+
}), dom);
|
|
116
|
+
}
|
|
105
117
|
return {
|
|
106
118
|
dom
|
|
107
119
|
};
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = customSearch;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _client = require("react-dom/client");
|
|
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");
|
|
@@ -39,6 +38,12 @@ var _IconSearchLine, _IconArrowOpenDownLin, _IconArrowOpenUpLine;
|
|
|
39
38
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
40
39
|
* SOFTWARE.
|
|
41
40
|
*/
|
|
41
|
+
let reactdom;
|
|
42
|
+
try {
|
|
43
|
+
reactdom = require('react-dom/client');
|
|
44
|
+
} catch {
|
|
45
|
+
reactdom = require('react-dom');
|
|
46
|
+
}
|
|
42
47
|
function SearchPanel({
|
|
43
48
|
view,
|
|
44
49
|
searchConfig
|
|
@@ -106,11 +111,18 @@ function customSearch(searchConfig) {
|
|
|
106
111
|
createPanel: view => {
|
|
107
112
|
const dom = document.createElement('div');
|
|
108
113
|
dom.style.padding = '8px';
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
}));
|
|
120
|
+
} else {
|
|
121
|
+
reactdom.render( /*#__PURE__*/_react.default.createElement(SearchPanel, {
|
|
122
|
+
view: view,
|
|
123
|
+
searchConfig: searchConfig
|
|
124
|
+
}), dom);
|
|
125
|
+
}
|
|
114
126
|
return {
|
|
115
127
|
dom
|
|
116
128
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-source-code-editor",
|
|
3
|
-
"version": "8.53.
|
|
3
|
+
"version": "8.53.2",
|
|
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.
|
|
27
|
-
"@instructure/ui-test-queries": "8.53.
|
|
28
|
-
"@instructure/ui-test-utils": "8.53.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.2",
|
|
27
|
+
"@instructure/ui-test-queries": "8.53.2",
|
|
28
|
+
"@instructure/ui-test-utils": "8.53.2",
|
|
29
29
|
"@testing-library/jest-dom": "^6.1.4",
|
|
30
30
|
"@testing-library/react": "^14.0.0"
|
|
31
31
|
},
|
|
@@ -44,26 +44,26 @@
|
|
|
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.
|
|
48
|
-
"@instructure/shared-types": "8.53.
|
|
49
|
-
"@instructure/ui-a11y-content": "8.53.
|
|
50
|
-
"@instructure/ui-buttons": "8.53.
|
|
51
|
-
"@instructure/ui-dom-utils": "8.53.
|
|
52
|
-
"@instructure/ui-i18n": "8.53.
|
|
53
|
-
"@instructure/ui-icons": "8.53.
|
|
54
|
-
"@instructure/ui-prop-types": "8.53.
|
|
55
|
-
"@instructure/ui-react-utils": "8.53.
|
|
56
|
-
"@instructure/ui-test-locator": "8.53.
|
|
57
|
-
"@instructure/ui-testable": "8.53.
|
|
58
|
-
"@instructure/ui-text-input": "8.53.
|
|
59
|
-
"@instructure/ui-themes": "8.53.
|
|
60
|
-
"@instructure/ui-utils": "8.53.
|
|
47
|
+
"@instructure/emotion": "8.53.2",
|
|
48
|
+
"@instructure/shared-types": "8.53.2",
|
|
49
|
+
"@instructure/ui-a11y-content": "8.53.2",
|
|
50
|
+
"@instructure/ui-buttons": "8.53.2",
|
|
51
|
+
"@instructure/ui-dom-utils": "8.53.2",
|
|
52
|
+
"@instructure/ui-i18n": "8.53.2",
|
|
53
|
+
"@instructure/ui-icons": "8.53.2",
|
|
54
|
+
"@instructure/ui-prop-types": "8.53.2",
|
|
55
|
+
"@instructure/ui-react-utils": "8.53.2",
|
|
56
|
+
"@instructure/ui-test-locator": "8.53.2",
|
|
57
|
+
"@instructure/ui-testable": "8.53.2",
|
|
58
|
+
"@instructure/ui-text-input": "8.53.2",
|
|
59
|
+
"@instructure/ui-themes": "8.53.2",
|
|
60
|
+
"@instructure/ui-utils": "8.53.2",
|
|
61
61
|
"@lezer/highlight": "1.1.6",
|
|
62
|
-
"prop-types": "^15.8.1"
|
|
63
|
-
"react-dom": "^18.2.0"
|
|
62
|
+
"prop-types": "^15.8.1"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
66
|
-
"react": ">=16.8 <=18"
|
|
65
|
+
"react": ">=16.8 <=18",
|
|
66
|
+
"react-dom": ">=16.8 <=18"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { useState } from 'react'
|
|
26
|
-
import { createRoot } from 'react-dom/client'
|
|
27
26
|
import {
|
|
28
27
|
setSearchQuery,
|
|
29
28
|
search,
|
|
@@ -41,6 +40,13 @@ import {
|
|
|
41
40
|
IconSearchLine
|
|
42
41
|
} from '@instructure/ui-icons'
|
|
43
42
|
|
|
43
|
+
let reactdom: any
|
|
44
|
+
try {
|
|
45
|
+
reactdom = require('react-dom/client')
|
|
46
|
+
} catch {
|
|
47
|
+
reactdom = require('react-dom')
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
export type SearchConfig = {
|
|
45
51
|
placeholder: string
|
|
46
52
|
nextResultLabel: string
|
|
@@ -138,8 +144,15 @@ export default function customSearch(searchConfig: SearchConfig | undefined) {
|
|
|
138
144
|
createPanel: (view) => {
|
|
139
145
|
const dom = document.createElement('div')
|
|
140
146
|
dom.style.padding = '8px'
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
if ('createRoot' in reactdom) {
|
|
148
|
+
const root = reactdom.createRoot(dom)
|
|
149
|
+
root.render(<SearchPanel view={view} searchConfig={searchConfig} />)
|
|
150
|
+
} else {
|
|
151
|
+
reactdom.render(
|
|
152
|
+
<SearchPanel view={view} searchConfig={searchConfig} />,
|
|
153
|
+
dom
|
|
154
|
+
)
|
|
155
|
+
}
|
|
143
156
|
return { dom }
|
|
144
157
|
}
|
|
145
158
|
})
|