@instructure/canvas-rce 5.11.0 → 5.11.1
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 +6 -0
- package/canvas/README.md +84 -0
- package/canvas/locales/en.json +934 -0
- package/canvas/package.json +189 -0
- package/es/rce/RceHtmlEditor.js +58 -20
- package/lib/rce/RceHtmlEditor.js +58 -20
- package/package.json +2 -4
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@instructure/canvas-rce",
|
|
3
|
+
"version": "5.1.1",
|
|
4
|
+
"description": "A component wrapping canvas's common tinymce usage",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"i18n:extract": "format-message extract \"src*/**/*.js\" -g underscored_crc32 -o locales/en.json",
|
|
9
|
+
"integration-test": "nightwatch --env integration",
|
|
10
|
+
"lint": "eslint \"src/**/*.js\" \"test/**/*.js\"",
|
|
11
|
+
"lint:fix": "eslint --fix \"src/**/*.js\" \"test/**/*.js\"",
|
|
12
|
+
"_test": "Test cafe will be added back to test as part of CORE-2995",
|
|
13
|
+
"test": "yarn test:mocha && yarn test:jest",
|
|
14
|
+
"test:mocha": "BABEL_ENV=test-node mocha 'test/**/*.test.js' --require @instructure/canvas-theme --require jsdom-global/register --require ./babel-register.js --timeout 5000 --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.js",
|
|
15
|
+
"test:mocha:one": "BABEL_ENV=test-node mocha --require @instructure/canvas-theme --require jsdom-global/register --require ./babel-register.js --timeout 5000 --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.js",
|
|
16
|
+
"test:mocha:debug": "BABEL_ENV=test-node mocha --inspect-brk --require @instructure/canvas-theme --require jsdom-global/register --require ./babel-register.js --timeout 5000 --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.js",
|
|
17
|
+
"test:jest": "jest --color --runInBand",
|
|
18
|
+
"test:cafe": "yarn build:cafe && yarn test:cafe:only",
|
|
19
|
+
"test:cafe:only": "testcafe chrome testcafe/**/*.test.js",
|
|
20
|
+
"test:cafe:one": "testcafe chrome testcafe/**/*.test.js --test ",
|
|
21
|
+
"test:cafe:all": "yarn build:cafe && testcafe chrome,firefox,safari testcafe/**/*.test.js",
|
|
22
|
+
"test:cafe:debug": "testcafe --inspect-brk chrome testcafe/**/*.test.js",
|
|
23
|
+
"test:watch": "BABEL_ENV=test-node mocha 'test/**/*.test.js' --require @instructure/canvas-theme --require ./babel-register.js --watch",
|
|
24
|
+
"test:coverage": "cross-env BABEL_ENV=test-node nyc -r html -r json node_modules/.bin/mocha -r jsdom-global/register 'test/**/*.test.js'",
|
|
25
|
+
"test:jest:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
26
|
+
"debug": "BABEL_ENV=test-node inspect _mocha --no-timeouts --debug-brk 'test/**/*.test.js' --require @instructure/canvas-theme --require ./babel-register.js",
|
|
27
|
+
"demo": "scripts/demo.sh",
|
|
28
|
+
"demo:clean": "rm -f github-pages/dist/*",
|
|
29
|
+
"demo:build": "webpack -c ./webpack.demo.config.js",
|
|
30
|
+
"demo:dev": "yarn demo:clean && mkdir -p ./github-pages/dist && cp ./github-pages/index.html ./github-pages/dist && webpack -c ./webpack.dev.config.js",
|
|
31
|
+
"installTranslations": "scripts/installTranslations.js",
|
|
32
|
+
"build:all": "scripts/build.js",
|
|
33
|
+
"build:canvas": "scripts/build-canvas",
|
|
34
|
+
"build:watch": "rm -rf es && ./node_modules/.bin/babel --out-dir es src --watch",
|
|
35
|
+
"build:cafe": "webpack --config webpack.testcafe.config.js",
|
|
36
|
+
"prepublishOnly": "yarn build:all && yarn test",
|
|
37
|
+
"fmt:check": "prettier -l '**/*.js'",
|
|
38
|
+
"fmt:fix": "prettier --write '**/*.js'",
|
|
39
|
+
"clean": "rm -rf lib && rm -rf es && rm -rf coverage && yarn demo:clean"
|
|
40
|
+
},
|
|
41
|
+
"author": "Instructure, Inc",
|
|
42
|
+
"license": "AGPL-3.0",
|
|
43
|
+
"browserslist": [
|
|
44
|
+
"extends @instructure/browserslist-config-canvas-lms"
|
|
45
|
+
],
|
|
46
|
+
"nyc": {
|
|
47
|
+
"include": [
|
|
48
|
+
"shared/**/*.js",
|
|
49
|
+
"src/**/*.js"
|
|
50
|
+
],
|
|
51
|
+
"exclude": [],
|
|
52
|
+
"require": [
|
|
53
|
+
"@babel/register",
|
|
54
|
+
"@instructure/canvas-theme"
|
|
55
|
+
],
|
|
56
|
+
"sourceMap": false,
|
|
57
|
+
"instrument": false
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@instructure/canvas-media": ">=1.0.0",
|
|
61
|
+
"@instructure/canvas-theme": "7",
|
|
62
|
+
"@instructure/k5uploader": ">=1",
|
|
63
|
+
"@instructure/media-capture": "~8.0.1-rc.11",
|
|
64
|
+
"@instructure/ui-a11y-content": "7",
|
|
65
|
+
"@instructure/ui-alerts": "7",
|
|
66
|
+
"@instructure/ui-avatar": "7",
|
|
67
|
+
"@instructure/ui-badge": "7",
|
|
68
|
+
"@instructure/ui-billboard": "7",
|
|
69
|
+
"@instructure/ui-buttons": "7",
|
|
70
|
+
"@instructure/ui-checkbox": "7",
|
|
71
|
+
"@instructure/ui-code-editor": "7.3.0",
|
|
72
|
+
"@instructure/ui-color-utils": "7",
|
|
73
|
+
"@instructure/ui-file-drop": "7",
|
|
74
|
+
"@instructure/ui-flex": "7",
|
|
75
|
+
"@instructure/ui-focusable": "7",
|
|
76
|
+
"@instructure/ui-form-field": "7",
|
|
77
|
+
"@instructure/ui-heading": "7",
|
|
78
|
+
"@instructure/ui-icons": "7",
|
|
79
|
+
"@instructure/ui-img": "7",
|
|
80
|
+
"@instructure/ui-link": "7",
|
|
81
|
+
"@instructure/ui-list": "7",
|
|
82
|
+
"@instructure/ui-media-player": "7",
|
|
83
|
+
"@instructure/ui-modal": "7",
|
|
84
|
+
"@instructure/ui-motion": "7",
|
|
85
|
+
"@instructure/ui-overlays": "7",
|
|
86
|
+
"@instructure/ui-pagination": "7",
|
|
87
|
+
"@instructure/ui-popover": "7",
|
|
88
|
+
"@instructure/ui-radio-input": "7",
|
|
89
|
+
"@instructure/ui-react-utils": "7",
|
|
90
|
+
"@instructure/ui-simple-select": "7",
|
|
91
|
+
"@instructure/ui-spinner": "7",
|
|
92
|
+
"@instructure/ui-svg-images": "7",
|
|
93
|
+
"@instructure/ui-tabs": "7",
|
|
94
|
+
"@instructure/ui-text": "7",
|
|
95
|
+
"@instructure/ui-text-area": "7",
|
|
96
|
+
"@instructure/ui-text-input": "7",
|
|
97
|
+
"@instructure/ui-themeable": "7",
|
|
98
|
+
"@instructure/ui-themes": "7",
|
|
99
|
+
"@instructure/ui-toggle-details": "7",
|
|
100
|
+
"@instructure/ui-tooltip": "7",
|
|
101
|
+
"@instructure/ui-tray": "7",
|
|
102
|
+
"@instructure/ui-tree-browser": "7",
|
|
103
|
+
"@instructure/ui-truncate-text": "7",
|
|
104
|
+
"@instructure/ui-utils": "7",
|
|
105
|
+
"@instructure/ui-view": "7",
|
|
106
|
+
"@instructure/uid": "7",
|
|
107
|
+
"@sheerun/mutationobserver-shim": "^0.3.2",
|
|
108
|
+
"@tinymce/tinymce-react": "~3.8.4",
|
|
109
|
+
"aphrodite": "^2",
|
|
110
|
+
"axios": "^0.21.1",
|
|
111
|
+
"bloody-offset": "0.0.0",
|
|
112
|
+
"classnames": "^2.2.5",
|
|
113
|
+
"format-message": "^6",
|
|
114
|
+
"format-message-generate-id": "^6",
|
|
115
|
+
"get-cookie": "1",
|
|
116
|
+
"i18n-js": "^3",
|
|
117
|
+
"i18nliner": "~0.2.0",
|
|
118
|
+
"isomorphic-fetch": "2.2.1",
|
|
119
|
+
"jquery": "https://github.com/instructure/jquery.git#1.7.2-with-AMD-and-CommonJS",
|
|
120
|
+
"js-beautify": "1",
|
|
121
|
+
"keycode": "^2",
|
|
122
|
+
"lodash": "^4",
|
|
123
|
+
"minimatch": "~3.0.4",
|
|
124
|
+
"prop-types": "^15",
|
|
125
|
+
"react": "^0.14.8 || ^15.0.0 || ^16",
|
|
126
|
+
"react-dom": "^0.14.8 || ^15.0.0 || ^16",
|
|
127
|
+
"react-draggable": "^3.3.0",
|
|
128
|
+
"react-redux": "^5",
|
|
129
|
+
"react-transition-group": "^1",
|
|
130
|
+
"redux": "^4",
|
|
131
|
+
"redux-batch-middleware": "^0.2.0",
|
|
132
|
+
"redux-thunk": "^2",
|
|
133
|
+
"scroll-into-view": "https://github.com/bkirkby/scroll-into-view.git#588b0ced98eeecf84e6fb2074aa076e80b7cffab",
|
|
134
|
+
"tinymce": "^5",
|
|
135
|
+
"tinymce-a11y-checker": "^3.0.0"
|
|
136
|
+
},
|
|
137
|
+
"devDependencies": {
|
|
138
|
+
"@babel/cli": "^7",
|
|
139
|
+
"@babel/core": "^7",
|
|
140
|
+
"@babel/register": "7",
|
|
141
|
+
"@instructure/browserslist-config-canvas-lms": ">=2",
|
|
142
|
+
"@instructure/translations": ">=1",
|
|
143
|
+
"@instructure/ui-babel-preset": "7",
|
|
144
|
+
"@testing-library/dom": "^7",
|
|
145
|
+
"@testing-library/jest-dom": "^5",
|
|
146
|
+
"@testing-library/react": "^11",
|
|
147
|
+
"@testing-library/user-event": "^12",
|
|
148
|
+
"axe-testcafe": "^3",
|
|
149
|
+
"babel-loader": "^8.0.0",
|
|
150
|
+
"babel-plugin-dynamic-import-node": "^2.2.0",
|
|
151
|
+
"babel-plugin-inline-json-import": "^0.2.0",
|
|
152
|
+
"babel-plugin-minify-constant-folding": "^0.5.0",
|
|
153
|
+
"babel-plugin-minify-dead-code-elimination": "^0.5.0",
|
|
154
|
+
"babel-plugin-minify-guarded-expressions": "^0.4.3",
|
|
155
|
+
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
|
|
156
|
+
"cross-env": "^5.0.0",
|
|
157
|
+
"eslint-plugin-mocha": "^6",
|
|
158
|
+
"eslint-plugin-testcafe": "^0.2.1",
|
|
159
|
+
"fetch-mock": "^6",
|
|
160
|
+
"format-message-cli": "^6",
|
|
161
|
+
"format-message-parse": "^6",
|
|
162
|
+
"jest": "^24",
|
|
163
|
+
"jest-canvas-mock": "^2",
|
|
164
|
+
"jest-environment-jsdom-fourteen": "^0.1.0",
|
|
165
|
+
"jest-junit": "^7",
|
|
166
|
+
"jsdom": "^13.0.0",
|
|
167
|
+
"jsdom-global": "^3.0.2",
|
|
168
|
+
"jsdomify": "^3",
|
|
169
|
+
"mocha": "^6",
|
|
170
|
+
"mocha-junit-reporter": "^1.18.0",
|
|
171
|
+
"mocha-multi-reporters": "^1.1.7",
|
|
172
|
+
"moxios": "^0.4",
|
|
173
|
+
"nyc": "^13",
|
|
174
|
+
"prettier": "^2.2.1",
|
|
175
|
+
"proxyquire": "1.7.4",
|
|
176
|
+
"shelljs": "^0.8.3",
|
|
177
|
+
"sinon": "^7",
|
|
178
|
+
"skin-deep": "^1",
|
|
179
|
+
"testcafe": "^1.9.0",
|
|
180
|
+
"testcafe-react-selectors": "^3.3.0",
|
|
181
|
+
"webpack": "^4",
|
|
182
|
+
"webpack-merge": "^5",
|
|
183
|
+
"webpack-nano": "^1",
|
|
184
|
+
"webpack-plugin-serve": "^1"
|
|
185
|
+
},
|
|
186
|
+
"resolutions": {
|
|
187
|
+
"format-message-estree-util": "../packages/format-message-estree-util"
|
|
188
|
+
}
|
|
189
|
+
}
|
package/es/rce/RceHtmlEditor.js
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import React, { useEffect, useState } from 'react';
|
|
18
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
19
19
|
import { func, string } from 'prop-types';
|
|
20
20
|
import formatMessage from '../format-message';
|
|
21
|
-
import {
|
|
21
|
+
import { CodeEditor } from '@instructure/ui-code-editor';
|
|
22
22
|
import beautify from 'js-beautify';
|
|
23
23
|
const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
24
24
|
let {
|
|
@@ -28,6 +28,28 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
28
28
|
const [code, setCode] = useState(props.code);
|
|
29
29
|
const label = formatMessage('html code editor');
|
|
30
30
|
const [dir, setDir] = useState(getComputedStyle(document.body, null).direction);
|
|
31
|
+
const [codeMirrorEditorDiv, setCodeMirrorEditorDiv] = useState(null);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
;
|
|
34
|
+
|
|
35
|
+
(async () => {
|
|
36
|
+
const p = new Promise(resolve => {
|
|
37
|
+
const timerid = setInterval(() => {
|
|
38
|
+
// scoping querySelector to the container div makes sure we're targeting this CodeEditor
|
|
39
|
+
// The CodeMirror docs (https://codemirror.net/doc/manual.html#styling)
|
|
40
|
+
// say this is the element we use to set the editor's height
|
|
41
|
+
const editor = editorRef.current.querySelector('.CodeMirror');
|
|
42
|
+
|
|
43
|
+
if (editor) {
|
|
44
|
+
clearInterval(timerid);
|
|
45
|
+
setCodeMirrorEditorDiv(editor);
|
|
46
|
+
resolve();
|
|
47
|
+
}
|
|
48
|
+
}, 60);
|
|
49
|
+
});
|
|
50
|
+
await p;
|
|
51
|
+
})();
|
|
52
|
+
}, [editorRef]);
|
|
31
53
|
useEffect(() => {
|
|
32
54
|
setCode(beautify.html(props.code)); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
55
|
}, []);
|
|
@@ -56,7 +78,23 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
56
78
|
|
|
57
79
|
setDir(getComputedStyle(editorRef.current || document.body, null).direction);
|
|
58
80
|
}, [dir, editorRef]);
|
|
59
|
-
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (codeMirrorEditorDiv) {
|
|
83
|
+
codeMirrorEditorDiv.CodeMirror.setSize(null, props.height);
|
|
84
|
+
codeMirrorEditorDiv.style.margin = '0';
|
|
85
|
+
codeMirrorEditorDiv.style.border = '0';
|
|
86
|
+
}
|
|
87
|
+
}, [codeMirrorEditorDiv, props.height]);
|
|
88
|
+
const isFocused = useRef(false); // move cursor to the top of the html code when the editor is focused for the first time
|
|
89
|
+
|
|
90
|
+
const handleFocus = useCallback((editor, event) => {
|
|
91
|
+
if (!isFocused.current) {
|
|
92
|
+
editor.setCursor(0, 0);
|
|
93
|
+
isFocused.current = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onFocus(event);
|
|
97
|
+
}, [onFocus]); // setting height on the container keeps the RCE toolbar from jumping
|
|
60
98
|
|
|
61
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
100
|
ref: editorRef,
|
|
@@ -66,28 +104,28 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
66
104
|
overflow: 'hidden',
|
|
67
105
|
textAlign: 'start'
|
|
68
106
|
}
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
107
|
+
}, /*#__PURE__*/React.createElement(CodeEditor, {
|
|
70
108
|
label: label,
|
|
71
|
-
language: "html"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
height: props.height,
|
|
109
|
+
language: "html",
|
|
110
|
+
options: {
|
|
111
|
+
lineNumbers: true,
|
|
112
|
+
lineWrapping: true,
|
|
113
|
+
autofocus: false,
|
|
114
|
+
spellcheck: true,
|
|
115
|
+
extraKeys: {
|
|
116
|
+
Tab: false,
|
|
117
|
+
'Shift-Tab': false
|
|
118
|
+
},
|
|
119
|
+
screenReaderLabel: label,
|
|
120
|
+
direction: dir,
|
|
121
|
+
rtlMoveVisually: true
|
|
122
|
+
},
|
|
86
123
|
value: code,
|
|
87
124
|
onChange: value => {
|
|
88
125
|
setCode(value);
|
|
89
126
|
props.onChange(value);
|
|
90
|
-
}
|
|
127
|
+
},
|
|
128
|
+
onFocus: handleFocus
|
|
91
129
|
}));
|
|
92
130
|
});
|
|
93
131
|
RceHtmlEditor.propTypes = {
|
package/lib/rce/RceHtmlEditor.js
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Affero General Public License along
|
|
16
16
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
import React, { useEffect, useState } from 'react';
|
|
18
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
19
19
|
import { func, string } from 'prop-types';
|
|
20
20
|
import formatMessage from '../format-message';
|
|
21
|
-
import {
|
|
21
|
+
import { CodeEditor } from '@instructure/ui-code-editor';
|
|
22
22
|
import beautify from 'js-beautify';
|
|
23
23
|
const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
24
24
|
let {
|
|
@@ -28,6 +28,28 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
28
28
|
const [code, setCode] = useState(props.code);
|
|
29
29
|
const label = formatMessage('html code editor');
|
|
30
30
|
const [dir, setDir] = useState(getComputedStyle(document.body, null).direction);
|
|
31
|
+
const [codeMirrorEditorDiv, setCodeMirrorEditorDiv] = useState(null);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
;
|
|
34
|
+
|
|
35
|
+
(async () => {
|
|
36
|
+
const p = new Promise(resolve => {
|
|
37
|
+
const timerid = setInterval(() => {
|
|
38
|
+
// scoping querySelector to the container div makes sure we're targeting this CodeEditor
|
|
39
|
+
// The CodeMirror docs (https://codemirror.net/doc/manual.html#styling)
|
|
40
|
+
// say this is the element we use to set the editor's height
|
|
41
|
+
const editor = editorRef.current.querySelector('.CodeMirror');
|
|
42
|
+
|
|
43
|
+
if (editor) {
|
|
44
|
+
clearInterval(timerid);
|
|
45
|
+
setCodeMirrorEditorDiv(editor);
|
|
46
|
+
resolve();
|
|
47
|
+
}
|
|
48
|
+
}, 60);
|
|
49
|
+
});
|
|
50
|
+
await p;
|
|
51
|
+
})();
|
|
52
|
+
}, [editorRef]);
|
|
31
53
|
useEffect(() => {
|
|
32
54
|
setCode(beautify.html(props.code)); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
55
|
}, []);
|
|
@@ -56,7 +78,23 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
56
78
|
|
|
57
79
|
setDir(getComputedStyle(editorRef.current || document.body, null).direction);
|
|
58
80
|
}, [dir, editorRef]);
|
|
59
|
-
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (codeMirrorEditorDiv) {
|
|
83
|
+
codeMirrorEditorDiv.CodeMirror.setSize(null, props.height);
|
|
84
|
+
codeMirrorEditorDiv.style.margin = '0';
|
|
85
|
+
codeMirrorEditorDiv.style.border = '0';
|
|
86
|
+
}
|
|
87
|
+
}, [codeMirrorEditorDiv, props.height]);
|
|
88
|
+
const isFocused = useRef(false); // move cursor to the top of the html code when the editor is focused for the first time
|
|
89
|
+
|
|
90
|
+
const handleFocus = useCallback((editor, event) => {
|
|
91
|
+
if (!isFocused.current) {
|
|
92
|
+
editor.setCursor(0, 0);
|
|
93
|
+
isFocused.current = true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onFocus(event);
|
|
97
|
+
}, [onFocus]); // setting height on the container keeps the RCE toolbar from jumping
|
|
60
98
|
|
|
61
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
100
|
ref: editorRef,
|
|
@@ -66,28 +104,28 @@ const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
|
|
|
66
104
|
overflow: 'hidden',
|
|
67
105
|
textAlign: 'start'
|
|
68
106
|
}
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
107
|
+
}, /*#__PURE__*/React.createElement(CodeEditor, {
|
|
70
108
|
label: label,
|
|
71
|
-
language: "html"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
height: props.height,
|
|
109
|
+
language: "html",
|
|
110
|
+
options: {
|
|
111
|
+
lineNumbers: true,
|
|
112
|
+
lineWrapping: true,
|
|
113
|
+
autofocus: false,
|
|
114
|
+
spellcheck: true,
|
|
115
|
+
extraKeys: {
|
|
116
|
+
Tab: false,
|
|
117
|
+
'Shift-Tab': false
|
|
118
|
+
},
|
|
119
|
+
screenReaderLabel: label,
|
|
120
|
+
direction: dir,
|
|
121
|
+
rtlMoveVisually: true
|
|
122
|
+
},
|
|
86
123
|
value: code,
|
|
87
124
|
onChange: value => {
|
|
88
125
|
setCode(value);
|
|
89
126
|
props.onChange(value);
|
|
90
|
-
}
|
|
127
|
+
},
|
|
128
|
+
onFocus: handleFocus
|
|
91
129
|
}));
|
|
92
130
|
});
|
|
93
131
|
RceHtmlEditor.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/canvas-rce",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.1",
|
|
4
4
|
"description": "A component wrapping Canvas's usage of Tinymce",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"build:canvas": "scripts/build-canvas",
|
|
41
41
|
"build:watch": "yarn clean:es && yarn build:es --watch",
|
|
42
42
|
"build:cafe": "wp --config webpack.testcafe.config.js",
|
|
43
|
-
"prepublishOnly": "yarn build:all",
|
|
43
|
+
"prepublishOnly": "yarn build:all && yarn test",
|
|
44
44
|
"fmt:check": "prettier -l '**/*.js*' '**/*.ts*'",
|
|
45
45
|
"fmt:fix": "prettier --write '**/*.js*' '**/*.ts*'",
|
|
46
46
|
"clean": "rm -rf lib && yarn clean:es && rm -rf coverage && yarn demo:clean",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"@instructure/canvas-media": "*",
|
|
79
79
|
"@instructure/debounce": "^8",
|
|
80
80
|
"@instructure/emotion": "^8.39",
|
|
81
|
-
"@instructure/filter-console-messages": "*",
|
|
82
81
|
"@instructure/k5uploader": "*",
|
|
83
82
|
"@instructure/media-capture": "^9.0.0",
|
|
84
83
|
"@instructure/theme-registry": "^8",
|
|
@@ -113,7 +112,6 @@
|
|
|
113
112
|
"@instructure/ui-radio-input": "^8",
|
|
114
113
|
"@instructure/ui-react-utils": "^8",
|
|
115
114
|
"@instructure/ui-simple-select": "^8",
|
|
116
|
-
"@instructure/ui-source-code-editor": "^8",
|
|
117
115
|
"@instructure/ui-spinner": "^8",
|
|
118
116
|
"@instructure/ui-svg-images": "^8",
|
|
119
117
|
"@instructure/ui-table": "^8",
|