@instructure/ui-source-code-editor 11.7.10 → 11.7.11-pr-snapshot-1794841957152

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es/SourceCodeEditor/v1/SearchPanel.js +81 -104
  3. package/es/SourceCodeEditor/v1/customKeybinding.js +85 -98
  4. package/es/SourceCodeEditor/v1/index.js +463 -507
  5. package/es/SourceCodeEditor/v1/props.js +30 -28
  6. package/es/SourceCodeEditor/v1/styles.js +198 -222
  7. package/es/SourceCodeEditor/v1/theme.js +19 -53
  8. package/es/SourceCodeEditor/v2/SearchPanel.js +81 -109
  9. package/es/SourceCodeEditor/v2/customKeybinding.js +85 -98
  10. package/es/SourceCodeEditor/v2/index.js +519 -545
  11. package/es/SourceCodeEditor/v2/props.js +30 -28
  12. package/es/SourceCodeEditor/v2/styles.js +208 -232
  13. package/es/exports/a.js +1 -24
  14. package/es/exports/b.js +1 -24
  15. package/package.json +16 -22
  16. package/src/SourceCodeEditor/v1/index.tsx +10 -5
  17. package/src/SourceCodeEditor/v2/index.tsx +47 -12
  18. package/tsconfig.build.json +0 -1
  19. package/tsconfig.build.tsbuildinfo +1 -1
  20. package/types/SourceCodeEditor/v1/index.d.ts +3 -1
  21. package/types/SourceCodeEditor/v1/index.d.ts.map +1 -1
  22. package/types/SourceCodeEditor/v2/index.d.ts +6 -1
  23. package/types/SourceCodeEditor/v2/index.d.ts.map +1 -1
  24. package/lib/SourceCodeEditor/v1/SearchPanel.js +0 -119
  25. package/lib/SourceCodeEditor/v1/customKeybinding.js +0 -105
  26. package/lib/SourceCodeEditor/v1/index.js +0 -550
  27. package/lib/SourceCodeEditor/v1/props.js +0 -33
  28. package/lib/SourceCodeEditor/v1/styles.js +0 -230
  29. package/lib/SourceCodeEditor/v1/theme.js +0 -60
  30. package/lib/SourceCodeEditor/v2/SearchPanel.js +0 -125
  31. package/lib/SourceCodeEditor/v2/customKeybinding.js +0 -105
  32. package/lib/SourceCodeEditor/v2/index.js +0 -591
  33. package/lib/SourceCodeEditor/v2/props.js +0 -33
  34. package/lib/SourceCodeEditor/v2/styles.js +0 -240
  35. package/lib/exports/a.js +0 -12
  36. package/lib/exports/b.js +0 -12
  37. package/lib/package.json +0 -1
@@ -1,591 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = exports.SourceCodeEditor = void 0;
9
- var _react = require("react");
10
- var _reactDom = require("react-dom");
11
- var _uiUtils = require("@instructure/ui-utils");
12
- var _state = require("@codemirror/state");
13
- var _view = require("@codemirror/view");
14
- var _autocomplete = require("@codemirror/autocomplete");
15
- var _search = require("@codemirror/search");
16
- var _commands = require("@codemirror/commands");
17
- var _lint = require("@codemirror/lint");
18
- var _language = require("@codemirror/language");
19
- var _langJavascript = require("@codemirror/lang-javascript");
20
- var _langHtml = require("@codemirror/lang-html");
21
- var _langCss = require("@codemirror/lang-css");
22
- var _langMarkdown = require("@codemirror/lang-markdown");
23
- var _langJson = require("@codemirror/lang-json");
24
- var _shell = require("@codemirror/legacy-modes/mode/shell");
25
- var _yaml = require("@codemirror/legacy-modes/mode/yaml");
26
- var _uiReactUtils = require("@instructure/ui-react-utils");
27
- var _uiDomUtils = require("@instructure/ui-dom-utils");
28
- var _uiA11yContent = require("@instructure/ui-a11y-content");
29
- var _uiI18n = require("@instructure/ui-i18n");
30
- var _emotion = require("@instructure/emotion");
31
- var _SearchPanel = _interopRequireWildcard(require("./SearchPanel.js"));
32
- var _styles = _interopRequireDefault(require("./styles.js"));
33
- var _customKeybinding = require("./customKeybinding.js");
34
- var _props = require("./props.js");
35
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
36
- var _dec, _dec2, _dec3, _class;
37
- /*
38
- * The MIT License (MIT)
39
- *
40
- * Copyright (c) 2015 - present Instructure, Inc.
41
- *
42
- * Permission is hereby granted, free of charge, to any person obtaining a copy
43
- * of this software and associated documentation files (the "Software"), to deal
44
- * in the Software without restriction, including without limitation the rights
45
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
- * copies of the Software, and to permit persons to whom the Software is
47
- * furnished to do so, subject to the following conditions:
48
- *
49
- * The above copyright notice and this permission notice shall be included in all
50
- * copies or substantial portions of the Software.
51
- *
52
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
- * SOFTWARE.
59
- */
60
- // import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
61
- /**
62
- ---
63
- category: components
64
- ---
65
- **/
66
- let SourceCodeEditor = exports.SourceCodeEditor = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyleNew)(_styles.default), _dec3 = (0, _uiI18n.textDirectionContextConsumer)(), _dec(_class = _dec2(_class = _dec3(_class = class SourceCodeEditor extends _react.Component {
67
- static displayName = 'SourceCodeEditor';
68
- static componentId = 'SourceCodeEditor';
69
- static allowedProps = _props.allowedProps;
70
- static defaultProps = {
71
- language: 'jsx',
72
- readOnly: false,
73
- editable: true,
74
- lineNumbers: false,
75
- foldGutter: false,
76
- highlightActiveLine: false,
77
- highlightActiveLineGutter: false,
78
- lineWrapping: false,
79
- autofocus: false,
80
- spellcheck: false,
81
- rtlMoveVisually: true,
82
- indentOnLoad: false,
83
- indentWithTab: false,
84
- defaultValue: '',
85
- height: 'auto'
86
- };
87
- _id;
88
- ref = null;
89
- state = {
90
- searchPanels: []
91
- };
92
- _containerRef;
93
- _editorView;
94
- _raf = [];
95
- _searchPanelId = 0;
96
- _isUnmounting = false;
97
- _newSelectionAfterValueChange;
98
- handleSearchPanelMount = (dom, view) => {
99
- this.setState(state => ({
100
- searchPanels: [...state.searchPanels, {
101
- id: ++this._searchPanelId,
102
- dom,
103
- view
104
- }]
105
- }));
106
- };
107
- handleSearchPanelDestroy = dom => {
108
- if (this._isUnmounting) return;
109
- this.setState(state => ({
110
- searchPanels: state.searchPanels.filter(panel => panel.dom !== dom)
111
- }));
112
- };
113
- handleRef = el => {
114
- const {
115
- elementRef
116
- } = this.props;
117
- this.ref = el;
118
- if (typeof elementRef === 'function') {
119
- elementRef(el);
120
- }
121
- };
122
- handleContainerRef = el => {
123
- const {
124
- containerRef
125
- } = this.props;
126
- this._containerRef = el || undefined;
127
- if (typeof containerRef === 'function') {
128
- containerRef(el);
129
- }
130
- };
131
- addAnimationFrame(callback) {
132
- if (typeof callback === 'function') {
133
- this._raf.push((0, _uiDomUtils.requestAnimationFrame)(callback));
134
- }
135
- }
136
- cancelAnimationFrames() {
137
- this._raf.forEach(request => request.cancel());
138
- this._raf = [];
139
- }
140
- focus() {
141
- this.addAnimationFrame(() => {
142
- this._editorView?.focus();
143
- });
144
- }
145
- get hasFocus() {
146
- return this._editorView?.hasFocus;
147
- }
148
- selectAll() {
149
- if (this._editorView) {
150
- this.addAnimationFrame(() => {
151
- this.dispatchViewSelection({
152
- anchor: 0,
153
- head: this.currentDocValue?.length
154
- });
155
- });
156
- }
157
- }
158
- deselectAll() {
159
- if (this._editorView) {
160
- this.addAnimationFrame(() => {
161
- this.dispatchViewSelection({
162
- anchor: 0,
163
- head: 0
164
- });
165
- });
166
- }
167
- }
168
- indentCurrentSelection() {
169
- this.addAnimationFrame(() => {
170
- if (this._editorView) {
171
- (0, _commands.indentSelection)({
172
- state: this._editorView.state,
173
- dispatch: transaction => {
174
- this._editorView?.update([transaction]);
175
- }
176
- });
177
- }
178
- });
179
- }
180
- indentAll() {
181
- this.addAnimationFrame(() => {
182
- if (this._editorView && this.currentDocValue) {
183
- this.indentCodeRange(0, this.currentDocValue.length);
184
- }
185
- });
186
- }
187
- indentCodeRange(from, to) {
188
- this.addAnimationFrame(() => {
189
- if (this._editorView && this.currentDocValue) {
190
- this.dispatchViewChanges({
191
- changes: (0, _language.indentRange)(this._editorView.state, from, to)
192
- });
193
- }
194
- });
195
- }
196
-
197
- // Attach state effects
198
- dispatchViewEffects(effects) {
199
- if (!this._editorView || !effects) return;
200
- this._editorView.dispatch({
201
- effects
202
- });
203
- }
204
-
205
- // Dispatch changes to the document
206
- dispatchViewChanges({
207
- changes,
208
- selection,
209
- userEvent
210
- }) {
211
- if (!this._editorView || !changes) return;
212
- this._editorView.dispatch({
213
- changes,
214
- ...(selection ? {
215
- selection
216
- } : undefined),
217
- ...(userEvent ? {
218
- userEvent
219
- } : undefined)
220
- });
221
- }
222
-
223
- // Select a portion of the document
224
- dispatchViewSelection(selection) {
225
- if (!this._editorView || !selection) return;
226
- this._editorView.dispatch({
227
- selection
228
- });
229
- }
230
- get currentDocValue() {
231
- return this._editorView?.state.doc;
232
- }
233
-
234
- // when value is passed, the editor should be controlled
235
- get isControlled() {
236
- return typeof this.props.value === 'string';
237
- }
238
- constructor(props) {
239
- super(props);
240
- this._id = props.deterministicId();
241
- }
242
- componentDidMount() {
243
- const {
244
- value,
245
- defaultValue,
246
- autofocus,
247
- indentOnLoad
248
- } = this.props;
249
- this.props.makeStyles?.();
250
- const state = _state.EditorState.create({
251
- doc: value || defaultValue,
252
- extensions: this.extensions
253
- });
254
- this._editorView = new _view.EditorView({
255
- state,
256
- parent: this._containerRef
257
- });
258
-
259
- // from the a11y team:
260
- // axe devtools and other automated a11y tests both flagging this issue,
261
- // which can be observed while navigating with keyboard:
262
- // Ensure elements that have scrollable content are accessible by keyboard
263
- // To solve this problem, you need to fix at least (1) of the following:
264
- // Element should have focusable content, Element should be focusable
265
- this._editorView.scrollDOM.tabIndex = 0;
266
- if (autofocus) {
267
- this.focus();
268
- }
269
- if (indentOnLoad) {
270
- this.indentAll();
271
- }
272
- this.assignAriaLabel();
273
- }
274
- componentWillUnmount() {
275
- this._isUnmounting = true;
276
- this._editorView?.destroy();
277
- this.cancelAnimationFrames();
278
- }
279
- componentDidUpdate(prevProps) {
280
- this.props.makeStyles?.();
281
- if (this._editorView) {
282
- if (this.props.value !== prevProps.value) {
283
- this.refreshEditorValue();
284
- }
285
- if (this.shouldUpdateExtensions(prevProps)) {
286
- this.refreshExtensions();
287
- }
288
- }
289
- }
290
- shouldUpdateExtensions(prevProps) {
291
- const propsToObserve = ['styles',
292
- // needed for theme update
293
- 'themeOverride', 'language', 'readOnly', 'editable', 'lineNumbers', 'highlightActiveLineGutter', 'foldGutter', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'dir', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'highlightActiveLine', 'attachment', 'searchConfig'];
294
- for (const prop of propsToObserve) {
295
- if (!(0, _uiUtils.deepEqual)(this.props[prop], prevProps[prop])) {
296
- return true;
297
- }
298
- }
299
- return false;
300
- }
301
- get direction() {
302
- // comes from the `direction` prop and
303
- // falls back to the `dir` prop coming from the bidirectional decorator
304
- return this.props.direction || this.props.dir;
305
- }
306
- get extensions() {
307
- const extensions = [...this.baseExtensions,
308
- // our custom extensions
309
- this.languageExtension, this.onChangeExtension, this.focusListenerExtension, this.announceLineNumberExtension];
310
- if (this.themeExtension) {
311
- extensions.push(this.themeExtension);
312
- }
313
- if (this.props.lineNumbers) {
314
- extensions.push((0, _view.lineNumbers)());
315
- }
316
- if (this.props.highlightActiveLine) {
317
- extensions.push((0, _view.highlightActiveLine)());
318
- }
319
- if (this.props.highlightActiveLineGutter) {
320
- extensions.push((0, _view.highlightActiveLineGutter)());
321
- }
322
- if (this.props.foldGutter) {
323
- extensions.push((0, _language.foldGutter)());
324
- }
325
- if (this.props.lineWrapping) {
326
- extensions.push(_view.EditorView.lineWrapping);
327
- }
328
- if (this.props.editable === false) {
329
- extensions.push(_view.EditorView.editable.of(false));
330
- }
331
- if (this.props.readOnly) {
332
- extensions.push(_state.EditorState.readOnly.of(true));
333
- }
334
- if (this.props.spellcheck) {
335
- extensions.push(_view.EditorView.contentAttributes.of({
336
- spellcheck: 'true'
337
- }));
338
- }
339
- if (this.direction) {
340
- extensions.push(_view.EditorView.contentAttributes.of({
341
- dir: this.direction
342
- }));
343
- }
344
- if (this.props.indentUnit) {
345
- extensions.push(_language.indentUnit.of(this.props.indentUnit));
346
- }
347
- return extensions;
348
- }
349
- get baseExtensions() {
350
- return [
351
- // The extensions are based on codemirrors basic setup from 'codemirror'.
352
- // It is recommended by CodeMirror, that if we want to configure
353
- // our editor more precisely, we have to copy the source
354
- // and adjust it as desired.
355
- (0, _view.highlightSpecialChars)(), (0, _commands.history)(), (0, _view.drawSelection)(), (0, _view.dropCursor)(), _state.EditorState.allowMultipleSelections.of(true), (0, _language.syntaxHighlighting)(_language.defaultHighlightStyle, {
356
- fallback: true
357
- }), (0, _language.bracketMatching)(), (0, _autocomplete.closeBrackets)(), (0, _autocomplete.autocompletion)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), (0, _search.highlightSelectionMatches)(), (0, _language.indentOnInput)(), (0, _SearchPanel.default)(this.props.searchConfig, {
358
- onMount: this.handleSearchPanelMount,
359
- onDestroy: this.handleSearchPanelDestroy
360
- }), _view.keymap.of(this.keymaps)];
361
- }
362
- get keymaps() {
363
- // TODO: if more keymaps are added, list them in the docs as well (#Command keybinding)
364
- const keymaps = [..._autocomplete.closeBracketsKeymap, ...this.commandKeybinding, ..._commands.historyKeymap, ..._language.foldKeymap, ..._autocomplete.completionKeymap, ..._lint.lintKeymap, ...(this.props.searchConfig ? _search.searchKeymap : [])];
365
- if (this.props.indentWithTab) {
366
- keymaps.push(_commands.indentWithTab);
367
- }
368
- return keymaps;
369
- }
370
- get commandKeybinding() {
371
- const {
372
- rtlMoveVisually
373
- } = this.props;
374
- if (this.direction === 'rtl' && !rtlMoveVisually) {
375
- const overrideableKeys = _customKeybinding.rtlHorizontalArrowKeymap.map(binding => binding.key ? binding.key : binding.mac ? binding.mac : binding);
376
- // we have to remove the binding we want to override from the original,
377
- // otherwise all will be merged and the defaults will still apply
378
- const filteredOriginal = _commands.defaultKeymap.filter(binding => binding.key ? overrideableKeys.indexOf(binding.key) < 0 : binding.mac ? overrideableKeys.indexOf(binding.mac) < 0 : false);
379
- return [...filteredOriginal, ..._customKeybinding.rtlHorizontalArrowKeymap];
380
- }
381
- return _commands.defaultKeymap;
382
- }
383
- get themeExtension() {
384
- const {
385
- styles
386
- } = this.props;
387
- if (!styles?.theme || !styles.highlightStyle) {
388
- return undefined;
389
- }
390
- const theme = _view.EditorView.theme(styles?.theme);
391
- const highlightStyle = (0, _language.syntaxHighlighting)(_language.HighlightStyle.define(styles?.highlightStyle));
392
-
393
- // see notes in props.ts
394
- // if (darkTheme) {
395
- // theme = oneDarkTheme
396
- // highlightStyle = syntaxHighlighting(oneDarkHighlightStyle)
397
- // }
398
-
399
- return [theme, highlightStyle];
400
- }
401
- get languageExtension() {
402
- const {
403
- language
404
- } = this.props;
405
- switch (language) {
406
- case 'json':
407
- return (0, _langJson.json)();
408
- case 'js':
409
- case 'jsx':
410
- case 'javascript':
411
- return (0, _langJavascript.javascript)({
412
- jsx: true,
413
- typescript: true
414
- });
415
- case 'html':
416
- return (0, _langHtml.html)({
417
- matchClosingTags: true,
418
- autoCloseTags: true
419
- });
420
- case 'css':
421
- return (0, _langCss.css)();
422
- case 'markdown':
423
- return (0, _langMarkdown.markdown)();
424
- case 'sh':
425
- case 'shell':
426
- case 'bash':
427
- // ????
428
- return _language.StreamLanguage.define(_shell.shell);
429
- case 'yml':
430
- case 'yaml':
431
- return _language.StreamLanguage.define(_yaml.yaml);
432
- default:
433
- return (0, _langJavascript.javascript)({
434
- jsx: true,
435
- typescript: true
436
- });
437
- }
438
- }
439
- callOnChangeHandler(newValue) {
440
- const {
441
- onChange,
442
- value
443
- } = this.props;
444
- this.addAnimationFrame(() => {
445
- if (typeof onChange === 'function' && newValue !== value) {
446
- onChange(newValue);
447
- }
448
- });
449
- }
450
- get onChangeExtension() {
451
- return _state.EditorState.changeFilter.of(transaction => {
452
- if (!this._editorView) {
453
- return false;
454
- }
455
- if (transaction.docChanged) {
456
- const newDoc = transaction.newDoc.toString();
457
- if (this.isControlled) {
458
- // the value will be changed by the onChange handler,
459
- // refreshEditorValue has to run first
460
- if (newDoc !== this.props.value) {
461
- this._newSelectionAfterValueChange = transaction.selection;
462
- this.cancelAnimationFrames();
463
- this.callOnChangeHandler(newDoc);
464
- return false;
465
- } else {
466
- return true;
467
- }
468
- } else {
469
- this.callOnChangeHandler(newDoc);
470
- }
471
- }
472
- return true;
473
- });
474
- }
475
- get focusListenerExtension() {
476
- const {
477
- onFocus,
478
- onBlur
479
- } = this.props;
480
- return _view.EditorView.updateListener.of(update => {
481
- if (update.focusChanged && this._editorView) {
482
- if (this.hasFocus) {
483
- if (typeof onFocus === 'function') {
484
- onFocus();
485
- }
486
- } else {
487
- if (typeof onBlur === 'function') {
488
- onBlur();
489
- }
490
- }
491
- }
492
- });
493
- }
494
- get announceLineNumberExtension() {
495
- return _state.EditorState.transactionExtender.of(tr => {
496
- const selection = tr.selection;
497
- const oldSelection = tr.startState.selection.main;
498
- if (selection && selection.main.empty && oldSelection.empty) {
499
- const oldLine = tr.startState.doc.lineAt(oldSelection.head);
500
- const newLine = tr.newDoc.lineAt(selection.main.head);
501
- if (oldLine.number != newLine.number) return {
502
- effects: _view.EditorView.announce.of(tr.startState.phrase('line ') + newLine.number + '.')
503
- };
504
- }
505
- return null;
506
- });
507
- }
508
- refreshExtensions() {
509
- this.dispatchViewEffects(_state.StateEffect.reconfigure.of(this.extensions));
510
- }
511
- refreshEditorValue() {
512
- if (!this._editorView) return;
513
- const {
514
- value
515
- } = this.props;
516
- const currentValue = this._editorView.state.doc.toString();
517
- if (typeof value !== 'undefined' && currentValue !== value) {
518
- let userEvent;
519
- const lengthDiff = value.length - currentValue.length;
520
-
521
- // setting user events are needed for the autocomplete to work
522
- // (only these 2 events, autocomplete doesn't work on paste, etc.)
523
- if (lengthDiff === 1) {
524
- userEvent = 'input.type';
525
- } else if (lengthDiff === -1) {
526
- userEvent = 'delete.backward';
527
- }
528
- const scrollTop = this._editorView.scrollDOM.scrollTop;
529
- this.dispatchViewChanges({
530
- changes: {
531
- from: 0,
532
- to: currentValue.length,
533
- insert: value || ''
534
- },
535
- selection: this._newSelectionAfterValueChange,
536
- userEvent: userEvent
537
- });
538
-
539
- // Restore scroll position after CodeMirror updates the DOM
540
- this.addAnimationFrame(() => {
541
- if (this._editorView) {
542
- this._editorView.scrollDOM.scrollTop = scrollTop;
543
- }
544
- });
545
- this._newSelectionAfterValueChange = undefined;
546
- }
547
- if (this.props.indentOnLoad) {
548
- this.indentAll();
549
- }
550
- }
551
- assignAriaLabel = () => {
552
- if (this._containerRef) {
553
- const editorDiv = this._containerRef.querySelector('[role="textbox"]');
554
- if (editorDiv) {
555
- editorDiv.setAttribute('aria-labelledby', `${this._id}`);
556
- }
557
- }
558
- };
559
- render() {
560
- const {
561
- label,
562
- styles,
563
- searchConfig,
564
- ...restProps
565
- } = this.props;
566
- return (0, _jsxRuntime.jsxs)("div", {
567
- "data-cid": "SourceCodeEditor",
568
- ref: this.handleRef,
569
- css: styles?.codeEditor,
570
- ...(0, _uiReactUtils.passthroughProps)((0, _uiReactUtils.omitProps)(restProps, SourceCodeEditor.allowedProps)),
571
- children: [(0, _jsxRuntime.jsxs)("label", {
572
- css: styles?.label,
573
- id: this._id,
574
- children: [(0, _jsxRuntime.jsx)(_uiA11yContent.ScreenReaderContent, {
575
- children: label
576
- }), (0, _jsxRuntime.jsx)("div", {
577
- ref: this.handleContainerRef,
578
- css: styles?.codeEditorContainer
579
- })]
580
- }), searchConfig && this.state.searchPanels.map(({
581
- id,
582
- dom,
583
- view
584
- }) => /*#__PURE__*/(0, _reactDom.createPortal)((0, _jsxRuntime.jsx)(_SearchPanel.SearchPanel, {
585
- view: view,
586
- searchConfig: searchConfig
587
- }), dom, String(id)))]
588
- });
589
- }
590
- }) || _class) || _class) || _class);
591
- var _default = exports.default = SourceCodeEditor;
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['label', 'language', 'readOnly', 'editable', 'lineNumbers', 'foldGutter', 'highlightActiveLineGutter', 'highlightActiveLine', 'lineWrapping', 'autofocus', 'spellcheck', 'direction', 'rtlMoveVisually', 'indentOnLoad', 'indentWithTab', 'indentUnit', 'defaultValue', 'value', 'onChange', 'onFocus', 'onBlur', 'attachment', 'height', 'width',
32
- // 'darkTheme',
33
- 'elementRef', 'containerRef', 'searchConfig'];