@instructure/ui-source-code-editor 8.25.1-snapshot-19
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 +17 -0
- package/README.md +48 -0
- package/es/SourceCodeEditor/SourceCodeEditorLocator.js +81 -0
- package/es/SourceCodeEditor/customKeybinding.js +96 -0
- package/es/SourceCodeEditor/index.js +587 -0
- package/es/SourceCodeEditor/props.js +55 -0
- package/es/SourceCodeEditor/styles.js +204 -0
- package/es/SourceCodeEditor/theme.js +52 -0
- package/es/index.js +24 -0
- package/lib/SourceCodeEditor/SourceCodeEditorLocator.js +92 -0
- package/lib/SourceCodeEditor/customKeybinding.js +104 -0
- package/lib/SourceCodeEditor/index.js +601 -0
- package/lib/SourceCodeEditor/props.js +67 -0
- package/lib/SourceCodeEditor/styles.js +213 -0
- package/lib/SourceCodeEditor/theme.js +60 -0
- package/lib/index.js +13 -0
- package/lib/package.json +1 -0
- package/package.json +68 -0
- package/src/SourceCodeEditor/README.md +794 -0
- package/src/SourceCodeEditor/SourceCodeEditorLocator.ts +56 -0
- package/src/SourceCodeEditor/customKeybinding.ts +121 -0
- package/src/SourceCodeEditor/index.tsx +659 -0
- package/src/SourceCodeEditor/props.ts +291 -0
- package/src/SourceCodeEditor/styles.ts +200 -0
- package/src/SourceCodeEditor/theme.ts +55 -0
- package/src/index.ts +25 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/SourceCodeEditor/SourceCodeEditorLocator.d.ts +607 -0
- package/types/SourceCodeEditor/SourceCodeEditorLocator.d.ts.map +1 -0
- package/types/SourceCodeEditor/customKeybinding.d.ts +4 -0
- package/types/SourceCodeEditor/customKeybinding.d.ts.map +1 -0
- package/types/SourceCodeEditor/index.d.ts +126 -0
- package/types/SourceCodeEditor/index.d.ts.map +1 -0
- package/types/SourceCodeEditor/props.d.ts +130 -0
- package/types/SourceCodeEditor/props.d.ts.map +1 -0
- package/types/SourceCodeEditor/styles.d.ts +14 -0
- package/types/SourceCodeEditor/styles.d.ts.map +1 -0
- package/types/SourceCodeEditor/theme.d.ts +10 -0
- package/types/SourceCodeEditor/theme.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { tags } from '@lezer/highlight';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* ---
|
|
28
|
+
* private: true
|
|
29
|
+
* ---
|
|
30
|
+
* Generates the style object from the theme and provided additional information
|
|
31
|
+
* @param {Object} componentTheme The theme variable object.
|
|
32
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
33
|
+
* @return {Object} The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, props) => {
|
|
36
|
+
const attachment = props.attachment;
|
|
37
|
+
const attachmentBorderRadius = {
|
|
38
|
+
top: {
|
|
39
|
+
borderBottomLeftRadius: 0,
|
|
40
|
+
borderBottomRightRadius: 0
|
|
41
|
+
},
|
|
42
|
+
bottom: {
|
|
43
|
+
borderTopLeftRadius: 0,
|
|
44
|
+
borderTopRightRadius: 0
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const attachmentVariants = {
|
|
48
|
+
top: {
|
|
49
|
+
marginBottom: 0,
|
|
50
|
+
marginTop: '0.25rem'
|
|
51
|
+
},
|
|
52
|
+
bottom: {
|
|
53
|
+
borderTopLeftRadius: 0,
|
|
54
|
+
borderTopRightRadius: 0,
|
|
55
|
+
marginBottom: '0.25rem'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
codeEditor: {
|
|
60
|
+
label: 'codeEditor',
|
|
61
|
+
position: 'relative'
|
|
62
|
+
},
|
|
63
|
+
codeEditorContainer: {
|
|
64
|
+
label: 'codeEditorContainer',
|
|
65
|
+
borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderColor,
|
|
66
|
+
borderStyle: 'solid',
|
|
67
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth,
|
|
68
|
+
borderRadius: componentTheme.borderRadius,
|
|
69
|
+
marginBottom: '1rem',
|
|
70
|
+
...(attachment && { ...attachmentVariants[attachment],
|
|
71
|
+
...attachmentBorderRadius[attachment]
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
theme: {
|
|
75
|
+
'&': {
|
|
76
|
+
overflow: 'hidden',
|
|
77
|
+
background: componentTheme.background,
|
|
78
|
+
height: 'auto',
|
|
79
|
+
fontFamily: componentTheme.fontFamily,
|
|
80
|
+
fontSize: componentTheme.fontSize,
|
|
81
|
+
color: componentTheme.color,
|
|
82
|
+
border: 0,
|
|
83
|
+
lineHeight: 1.4375,
|
|
84
|
+
minHeight: '1.4375rem',
|
|
85
|
+
borderRadius: componentTheme.borderRadius,
|
|
86
|
+
...(attachment && { ...attachmentBorderRadius[attachment]
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
'&.cm-editor.cm-focused': {
|
|
90
|
+
// Provide a simple default outline to make sure a focused
|
|
91
|
+
// editor is visually distinct. Can't leave the default behavior
|
|
92
|
+
// because that will apply to the content element, which is
|
|
93
|
+
// inside the scrollable container and doesn't include the
|
|
94
|
+
// gutters. We also can't use an 'auto' outline, since those
|
|
95
|
+
// are, for some reason, drawn behind the element content, which
|
|
96
|
+
// will cause things like the active line background to cover
|
|
97
|
+
// the outline (#297).
|
|
98
|
+
outline: `${componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderWidth} solid ${componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.focusBorderColor}`
|
|
99
|
+
},
|
|
100
|
+
'.cm-content': {
|
|
101
|
+
padding: `${componentTheme.verticalPadding} 0`
|
|
102
|
+
},
|
|
103
|
+
'.cm-scroller': {
|
|
104
|
+
fontFamily: componentTheme.fontFamily,
|
|
105
|
+
lineHeight: 1.4375
|
|
106
|
+
},
|
|
107
|
+
'.cm-gutters': {
|
|
108
|
+
background: componentTheme.gutterBackground,
|
|
109
|
+
borderColor: componentTheme.borderColor
|
|
110
|
+
},
|
|
111
|
+
'.cm-line': {
|
|
112
|
+
padding: `0 ${componentTheme.horizontalPadding}`
|
|
113
|
+
},
|
|
114
|
+
'.cm-selectionBackground': {
|
|
115
|
+
background: 'transparent'
|
|
116
|
+
},
|
|
117
|
+
'.cm-focused .cm-selectionBackground': {
|
|
118
|
+
background: '#d7d4f0'
|
|
119
|
+
},
|
|
120
|
+
'.cm-placeholder': {
|
|
121
|
+
// for better contrast
|
|
122
|
+
color: '#707070'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
highlightStyle: [
|
|
126
|
+
/**
|
|
127
|
+
* Copy of `defaultHighlightStyle` from '@codemirror/language'
|
|
128
|
+
*/
|
|
129
|
+
// { tag: tags.meta, color: '#7a757a' },
|
|
130
|
+
{
|
|
131
|
+
tag: tags.link,
|
|
132
|
+
textDecoration: 'underline'
|
|
133
|
+
}, {
|
|
134
|
+
tag: tags.heading,
|
|
135
|
+
textDecoration: 'underline',
|
|
136
|
+
fontWeight: 'bold'
|
|
137
|
+
}, {
|
|
138
|
+
tag: tags.emphasis,
|
|
139
|
+
fontStyle: 'italic'
|
|
140
|
+
}, {
|
|
141
|
+
tag: tags.strong,
|
|
142
|
+
fontWeight: 'bold'
|
|
143
|
+
}, {
|
|
144
|
+
tag: tags.strikethrough,
|
|
145
|
+
textDecoration: 'line-through'
|
|
146
|
+
}, {
|
|
147
|
+
tag: tags.keyword,
|
|
148
|
+
color: '#708'
|
|
149
|
+
}, {
|
|
150
|
+
tag: [tags.atom, tags.bool, tags.url, tags.contentSeparator, tags.labelName],
|
|
151
|
+
color: '#219'
|
|
152
|
+
}, {
|
|
153
|
+
tag: [tags.literal, tags.inserted],
|
|
154
|
+
color: '#164'
|
|
155
|
+
}, {
|
|
156
|
+
tag: [tags.string, tags.deleted],
|
|
157
|
+
color: '#a11'
|
|
158
|
+
}, // {
|
|
159
|
+
// tag: [tags.regexp, tags.escape, tags.special(tags.string)],
|
|
160
|
+
// color: '#e40'
|
|
161
|
+
// },
|
|
162
|
+
{
|
|
163
|
+
tag: tags.definition(tags.variableName),
|
|
164
|
+
color: '#00f'
|
|
165
|
+
}, {
|
|
166
|
+
tag: tags.local(tags.variableName),
|
|
167
|
+
color: '#30a'
|
|
168
|
+
}, // { tag: [tags.typeName, tags.namespace], color: '#085' },
|
|
169
|
+
{
|
|
170
|
+
tag: tags.className,
|
|
171
|
+
color: '#167'
|
|
172
|
+
}, {
|
|
173
|
+
tag: [tags.special(tags.variableName), tags.macroName],
|
|
174
|
+
color: '#256'
|
|
175
|
+
}, {
|
|
176
|
+
tag: tags.definition(tags.propertyName),
|
|
177
|
+
color: '#00c'
|
|
178
|
+
}, {
|
|
179
|
+
tag: tags.comment,
|
|
180
|
+
color: '#940'
|
|
181
|
+
}, // { tag: tags.invalid, color: '#f00' },
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Custom highlighting overrides
|
|
185
|
+
* (where original colors don't have enough contrast against #fff
|
|
186
|
+
* or active highlight background)
|
|
187
|
+
*/
|
|
188
|
+
{
|
|
189
|
+
tag: tags.meta,
|
|
190
|
+
color: '#757075'
|
|
191
|
+
}, {
|
|
192
|
+
tag: [tags.regexp, tags.escape, tags.special(tags.string)],
|
|
193
|
+
color: '#d13b00'
|
|
194
|
+
}, {
|
|
195
|
+
tag: [tags.typeName, tags.namespace],
|
|
196
|
+
color: '#008051'
|
|
197
|
+
}, {
|
|
198
|
+
tag: tags.invalid,
|
|
199
|
+
color: '#e60000'
|
|
200
|
+
}]
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default generateStyle;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
const generateComponentTheme = theme => {
|
|
31
|
+
const colors = theme.colors,
|
|
32
|
+
borders = theme.borders,
|
|
33
|
+
typography = theme.typography,
|
|
34
|
+
spacing = theme.spacing;
|
|
35
|
+
const componentVariables = {
|
|
36
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamilyMonospace,
|
|
37
|
+
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
38
|
+
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
39
|
+
color: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
40
|
+
gutterBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
|
|
41
|
+
borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
42
|
+
borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
|
|
43
|
+
borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
|
|
44
|
+
focusBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
|
|
45
|
+
horizontalPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
|
|
46
|
+
verticalPadding: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall
|
|
47
|
+
};
|
|
48
|
+
return { ...componentVariables
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default generateComponentTheme;
|
package/es/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { SourceCodeEditor } from './SourceCodeEditor';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SourceCodeEditorLocator = void 0;
|
|
7
|
+
|
|
8
|
+
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
+
|
|
10
|
+
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
+
|
|
12
|
+
var _index = require("./index");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
|
+
const SourceCodeEditorLocator = (0, _locator.locator)(_index.SourceCodeEditor.selector, {
|
|
39
|
+
findContainer: async function () {
|
|
40
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
41
|
+
args[_key] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return await (0, _uiTestQueries.find)('[class$=-codeEditorContainer]', ...args);
|
|
45
|
+
},
|
|
46
|
+
findLabel: async function () {
|
|
47
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
48
|
+
args[_key2] = arguments[_key2];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return await (0, _uiTestQueries.find)('[class$=-screenReaderContent]', ...args);
|
|
52
|
+
},
|
|
53
|
+
findInput: async function () {
|
|
54
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
55
|
+
args[_key3] = arguments[_key3];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return await (0, _uiTestQueries.find)('[role="textbox"]', ...args);
|
|
59
|
+
},
|
|
60
|
+
findGutter: async function () {
|
|
61
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
62
|
+
args[_key4] = arguments[_key4];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return await (0, _uiTestQueries.find)('.cm-gutter', ...args);
|
|
66
|
+
},
|
|
67
|
+
findScroller: async function () {
|
|
68
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
69
|
+
args[_key5] = arguments[_key5];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return await (0, _uiTestQueries.find)('.cm-scroller', ...args);
|
|
73
|
+
},
|
|
74
|
+
findAllLines: async function () {
|
|
75
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
76
|
+
args[_key6] = arguments[_key6];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return await (0, _uiTestQueries.findAll)('.cm-line', ...args);
|
|
80
|
+
},
|
|
81
|
+
findAllGutterElements: async function () {
|
|
82
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
83
|
+
args[_key7] = arguments[_key7];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const allGutterElements = await (0, _uiTestQueries.findAll)('.cm-gutterElement', ...args); // first gutter element is always a placeholder
|
|
87
|
+
|
|
88
|
+
allGutterElements.shift();
|
|
89
|
+
return allGutterElements;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
exports.SourceCodeEditorLocator = SourceCodeEditorLocator;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.rtlHorizontalArrowKeymap = void 0;
|
|
7
|
+
|
|
8
|
+
var _commands = require("@codemirror/commands");
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* The MIT License (MIT)
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
14
|
+
*
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
* in the Software without restriction, including without limitation the rights
|
|
18
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
* furnished to do so, subject to the following conditions:
|
|
21
|
+
*
|
|
22
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
* copies or substantial portions of the Software.
|
|
24
|
+
*
|
|
25
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
* SOFTWARE.
|
|
32
|
+
*/
|
|
33
|
+
const rtlHorizontalArrowKeymap = [// Left/Start/Forward
|
|
34
|
+
{
|
|
35
|
+
key: 'ArrowLeft',
|
|
36
|
+
run: _commands.cursorCharRight,
|
|
37
|
+
shift: _commands.selectCharRight,
|
|
38
|
+
preventDefault: true
|
|
39
|
+
}, {
|
|
40
|
+
key: 'Mod-ArrowLeft',
|
|
41
|
+
mac: 'Alt-ArrowLeft',
|
|
42
|
+
run: _commands.cursorGroupRight,
|
|
43
|
+
shift: _commands.selectGroupRight
|
|
44
|
+
}, {
|
|
45
|
+
key: 'Alt-ArrowLeft',
|
|
46
|
+
mac: 'Ctrl-ArrowLeft',
|
|
47
|
+
run: _commands.cursorSyntaxRight,
|
|
48
|
+
shift: _commands.selectSyntaxRight
|
|
49
|
+
}, {
|
|
50
|
+
mac: 'Cmd-ArrowLeft',
|
|
51
|
+
run: _commands.cursorLineBoundaryForward,
|
|
52
|
+
shift: _commands.selectLineBoundaryForward
|
|
53
|
+
}, {
|
|
54
|
+
key: 'Home',
|
|
55
|
+
run: _commands.cursorLineBoundaryForward,
|
|
56
|
+
shift: _commands.selectLineBoundaryForward
|
|
57
|
+
}, // Right/End/Backward
|
|
58
|
+
{
|
|
59
|
+
key: 'ArrowRight',
|
|
60
|
+
run: _commands.cursorCharLeft,
|
|
61
|
+
shift: _commands.selectCharLeft,
|
|
62
|
+
preventDefault: true
|
|
63
|
+
}, {
|
|
64
|
+
key: 'Mod-ArrowRight',
|
|
65
|
+
mac: 'Alt-ArrowRight',
|
|
66
|
+
run: _commands.cursorGroupLeft,
|
|
67
|
+
shift: _commands.selectGroupLeft
|
|
68
|
+
}, {
|
|
69
|
+
key: 'Alt-ArrowRight',
|
|
70
|
+
mac: 'Ctrl-ArrowRight',
|
|
71
|
+
run: _commands.cursorSyntaxLeft,
|
|
72
|
+
shift: _commands.selectSyntaxLeft
|
|
73
|
+
}, {
|
|
74
|
+
mac: 'Cmd-ArrowRight',
|
|
75
|
+
run: _commands.cursorLineBoundaryBackward,
|
|
76
|
+
shift: _commands.selectLineBoundaryBackward
|
|
77
|
+
}, {
|
|
78
|
+
key: 'End',
|
|
79
|
+
run: _commands.cursorLineBoundaryBackward,
|
|
80
|
+
shift: _commands.selectLineBoundaryBackward
|
|
81
|
+
}, // Delete/Backspace
|
|
82
|
+
{
|
|
83
|
+
key: 'Delete',
|
|
84
|
+
run: _commands.deleteCharBackward
|
|
85
|
+
}, {
|
|
86
|
+
key: 'Mod-Delete',
|
|
87
|
+
mac: 'Alt-Delete',
|
|
88
|
+
run: _commands.deleteGroupBackward
|
|
89
|
+
}, {
|
|
90
|
+
key: 'Backspace',
|
|
91
|
+
run: _commands.deleteCharForward,
|
|
92
|
+
shift: _commands.deleteCharForward
|
|
93
|
+
}, {
|
|
94
|
+
key: 'Mod-Backspace',
|
|
95
|
+
mac: 'Alt-Backspace',
|
|
96
|
+
run: _commands.deleteGroupForward
|
|
97
|
+
}, {
|
|
98
|
+
mac: 'Mod-Delete',
|
|
99
|
+
run: _commands.deleteToLineStart
|
|
100
|
+
}, {
|
|
101
|
+
mac: 'Mod-Backspace',
|
|
102
|
+
run: _commands.deleteToLineEnd
|
|
103
|
+
}];
|
|
104
|
+
exports.rtlHorizontalArrowKeymap = rtlHorizontalArrowKeymap;
|