Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@instructure/canvas-rce

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instructure/canvas-rce - npm Package Compare versions

Comparing version 5.13.6 to 5.14.0

__mocks__/@instructure/studio-player/_mockStudioPlayer.js

18

CHANGELOG.md

@@ -8,6 +8,20 @@ # Changelog

## 5.13.5 - 2024-09-25
## 5.14.0 - 2024-10-18
### Added
- New optional media player for upload previews
### Fixed
- Keyboard trap when switching to the HTML Editor
### Changed
- Upgraded React to 18
## 5.13.6 - 2024-09-25
### Fixed
- File links with data-canvas-previewable='false' will no longer try to preview

@@ -26,3 +40,3 @@ - Change backgroundless buttons to "primary" theme color to be more visible

## 5.13.4 - 2024-08-12
## 5.13.5 - 2024-08-12

@@ -29,0 +43,0 @@ ### Fixed

16

es/rce/plugins/instructure_equation/EquationEditorModal/index.js

@@ -80,3 +80,3 @@ /*

} = this.props;
const output = this.state.advanced ? this.state.workingFormula : this.mathField.getValue();
const output = this.state.advanced ? this.state.workingFormula : this.getMathFiled();

@@ -103,3 +103,3 @@ if (output) {

if (state.advanced) {
this.mathField.setValue(state.workingFormula || '');
this.setMathField(state.workingFormula || '');
return {

@@ -112,3 +112,3 @@ advanced: false,

advanced: true,
workingFormula: this.mathField.getValue()
workingFormula: this.getMathFiled()
};

@@ -287,3 +287,3 @@ }

this.stubMacros();
if (!this.state.advanced) this.mathField.setValue(this.state.workingFormula);
if (!this.state.advanced) this.setMathField(this.state.workingFormula);
this.insertNewRange();

@@ -310,2 +310,10 @@ }

setMathField(formula) {
this.mathField.setValue(formula);
}
getMathFiled() {
return this.mathField.getValue();
}
}

@@ -312,0 +320,0 @@ EquationEditorModal.debounceRate = 1000;

@@ -54,2 +54,3 @@ /*

subtitles,
attachment_id: audioOptions.attachmentId,
updateMediaObject: contentProps.updateMediaObject

@@ -56,0 +57,0 @@ });

@@ -23,2 +23,3 @@ /*

import AudioOptionsTray from '.';
import RCEGlobals from '../../../RCEGlobals';
export const CONTAINER_ID = 'instructure-audio-options-tray-container';

@@ -91,3 +92,5 @@ export default class TrayController {

_applyAudioOptions(audioOptions) {
if (!audioOptions.media_object_id || audioOptions.media_object_id === 'undefined') {
const hasAttachmentId = RCEGlobals.getFeatures().media_links_use_attachment_id && audioOptions.attachment_id;
if (!hasAttachmentId && (!audioOptions.media_object_id || audioOptions.media_object_id === 'undefined')) {
return;

@@ -99,3 +102,4 @@ }

media_object_id: audioOptions.media_object_id,
subtitles: audioOptions.subtitles
subtitles: audioOptions.subtitles,
attachment_id: audioOptions.attachment_id
}).then(() => container === null || container === void 0 ? void 0 : container.contentWindow.location.reload()).catch(ex => {

@@ -115,3 +119,3 @@ // eslint-disable-next-line no-console

if ((event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.subject) === "media_tracks_response") {
if ((event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.subject) === 'media_tracks_response') {
var _event$data2;

@@ -118,0 +122,0 @@

@@ -82,25 +82,30 @@ /*

const trayProps = Bridge.trayProps.get(ed);
ReactDOM.render( /*#__PURE__*/React.createElement(StoreProvider, trayProps, contentProps => /*#__PURE__*/React.createElement(UploadMedia, {
"data-mce-component": true,
rcsConfig: {
contextType: ed.settings.canvas_rce_user_context.type,
contextId: ed.settings.canvas_rce_user_context.id,
origin: originFromHost(contentProps.host),
headers: headerFor(contentProps.jwt)
},
userLocale: Bridge.userLocale,
mountNode: instuiPopupMountNode,
open: true,
liveRegion: () => document.getElementById('flash_screenreader_holder'),
onStartUpload: fileProps => handleStartUpload(fileProps),
onUploadComplete: (err, data) => handleUpload(err, data, contentProps.mediaUploadComplete, uploadBookmark),
onDismiss: handleDismiss,
tabs: {
record: true,
upload: true
},
uploadMediaTranslations: Bridge.uploadMediaTranslations,
media_links_use_attachment_id: RCEGlobals.getFeatures().media_links_use_attachment_id
})), container);
ReactDOM.render( /*#__PURE__*/React.createElement(StoreProvider, trayProps, contentProps => {
var _RCEGlobals$getFeatur;
return /*#__PURE__*/React.createElement(UploadMedia, {
"data-mce-component": true,
rcsConfig: {
contextType: ed.settings.canvas_rce_user_context.type,
contextId: ed.settings.canvas_rce_user_context.id,
origin: originFromHost(contentProps.host),
headers: headerFor(contentProps.jwt)
},
userLocale: Bridge.userLocale,
mountNode: instuiPopupMountNode,
open: true,
liveRegion: () => document.getElementById('flash_screenreader_holder'),
onStartUpload: fileProps => handleStartUpload(fileProps),
onUploadComplete: (err, data) => handleUpload(err, data, contentProps.mediaUploadComplete, uploadBookmark),
onDismiss: handleDismiss,
tabs: {
record: true,
upload: true
},
uploadMediaTranslations: Bridge.uploadMediaTranslations,
media_links_use_attachment_id: RCEGlobals.getFeatures().media_links_use_attachment_id,
useStudioPlayer: (_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) === null || _RCEGlobals$getFeatur === void 0 ? void 0 : _RCEGlobals$getFeatur.consolidated_media_player
});
}), container);
});
}

@@ -149,3 +149,5 @@ /*

if (videoOptions.media_object_id && videoOptions.media_object_id !== 'undefined' && !videoOptions.editLocked) {
const hasMediaId = videoOptions.media_object_id && videoOptions.media_object_id !== 'undefined' || data.attachment_id && data.attachment_id !== 'undefined';
if (hasMediaId && !videoOptions.editLocked) {
videoOptions.updateMediaObject(data).then(_r => {

@@ -155,3 +157,4 @@ if (this.$videoContainer && videoOptions.displayAs === 'embed') {

subject: 'reload_media',
media_object_id: videoOptions.media_object_id
media_object_id: videoOptions.media_object_id,
attachment_id: data.attachment_id
}, bridge.canvasOrigin);

@@ -190,3 +193,3 @@ }

if ((event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.subject) === "media_tracks_response") {
if ((event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.subject) === 'media_tracks_response') {
var _event$data2;

@@ -193,0 +196,0 @@

@@ -19,6 +19,8 @@ /*

import { fromImageEmbed, fromVideoEmbed } from '../instructure_image/ImageEmbedOptions';
import { isOnlyTextSelected } from '../../contentInsertionUtils';
import { isOnlyTextSelected } from '../../contentInsertionUtils'; // eslint-disable-next-line import/no-nodejs-modules
import * as url from 'url';
import formatMessage from '../../../format-message';
import { isStudioEmbeddedMedia } from './StudioLtiSupportUtils';
import RCEGlobals from '../../RCEGlobals';
const FILE_DOWNLOAD_PATH_REGEX = /^\/(courses\/\d+\/)?files\/\d+\/download$/;

@@ -147,2 +149,11 @@ export const LINK_TYPE = 'link';

if (RCEGlobals.getFeatures().media_links_use_attachment_id) {
const source = $audioIframe.getAttribute('src');
const matches = source === null || source === void 0 ? void 0 : source.match(/\/media_attachments_iframe\/(\d+)/);
if (matches) {
audioOptions.attachmentId = matches[1];
}
}
return audioOptions;

@@ -216,3 +227,3 @@ }

function isMediaElement($element, mediaType) {
var _tinymceIframeShim$fi;
var _tinymceIframeShim$fi, _tinymceIframeShim$ge;

@@ -232,4 +243,5 @@ // the video is hosted in an iframe, but tinymce

const media_obj_id = tinymceIframeShim.getAttribute('data-mce-p-data-media-id');
const is_media_attachment_iframe = (_tinymceIframeShim$ge = tinymceIframeShim.getAttribute('data-mce-p-src')) === null || _tinymceIframeShim$ge === void 0 ? void 0 : _tinymceIframeShim$ge.includes('media_attachments_iframe');
if (!media_obj_id) {
if (!media_obj_id && !is_media_attachment_iframe) {
return false;

@@ -236,0 +248,0 @@ }

@@ -21,35 +21,9 @@ /*

import formatMessage from '../format-message';
import { CodeEditor } from '@instructure/ui-code-editor';
import { SourceCodeEditor } from '@instructure/ui-source-code-editor';
import beautify from 'js-beautify';
const RceHtmlEditor = /*#__PURE__*/React.forwardRef((_ref, editorRef) => {
let {
onFocus,
...props
} = _ref;
const RceHtmlEditor = /*#__PURE__*/React.forwardRef((props, editorRef) => {
const [code, setCode] = useState(props.code);
const label = formatMessage('html code editor');
const [dir, setDir] = useState(getComputedStyle(document.body, null).direction);
const [codeMirrorEditorDiv, setCodeMirrorEditorDiv] = useState(null);
useEffect(() => {
;
(async () => {
const p = new Promise(resolve => {
const timerid = setInterval(() => {
// scoping querySelector to the container div makes sure we're targeting this CodeEditor
// The CodeMirror docs (https://codemirror.net/doc/manual.html#styling)
// say this is the element we use to set the editor's height
const editor = editorRef.current.querySelector('.CodeMirror');
if (editor) {
clearInterval(timerid);
setCodeMirrorEditorDiv(editor);
resolve();
}
}, 60);
});
await p;
})();
}, [editorRef]);
useEffect(() => {
setCode(beautify.html(props.code)); // eslint-disable-next-line react-hooks/exhaustive-deps

@@ -82,20 +56,4 @@ }, []);

}, [dir, editorRef]);
useEffect(() => {
if (codeMirrorEditorDiv) {
codeMirrorEditorDiv.CodeMirror.setSize(null, props.height);
codeMirrorEditorDiv.style.margin = '0';
codeMirrorEditorDiv.style.border = '0';
}
}, [codeMirrorEditorDiv, props.height]);
const isFocused = useRef(false); // move cursor to the top of the html code when the editor is focused for the first time
const direction = ['ltr', 'rtl'].includes(dir) ? dir : 'ltr'; // setting height on the container keeps the RCE toolbar from jumping
const handleFocus = useCallback((editor, event) => {
if (!isFocused.current) {
editor.setCursor(0, 0);
isFocused.current = true;
}
onFocus(event);
}, [onFocus]); // setting height on the container keeps the RCE toolbar from jumping
return /*#__PURE__*/React.createElement("div", {

@@ -109,18 +67,12 @@ ref: editorRef,

}
}, /*#__PURE__*/React.createElement(CodeEditor, {
}, /*#__PURE__*/React.createElement(SourceCodeEditor, {
label: label,
language: "html",
options: {
lineNumbers: true,
lineWrapping: true,
autofocus: false,
spellcheck: true,
extraKeys: {
Tab: false,
'Shift-Tab': false
},
screenReaderLabel: label,
direction: dir,
rtlMoveVisually: true
},
lineNumbers: true,
lineWrapping: true,
autofocus: true,
spellcheck: true,
direction: direction,
rtlMoveVisually: true,
height: props.height,
value: code,

@@ -130,4 +82,3 @@ onChange: value => {

props.onChange(value);
},
onFocus: handleFocus
}
}));

@@ -138,10 +89,8 @@ });

height: string,
onChange: func,
onFocus: func
onChange: func
};
RceHtmlEditor.defaultProps = {
height: 'auto',
onChange: _value => {},
onFocus: () => {}
onChange: _value => {}
};
export default RceHtmlEditor;

@@ -37,2 +37,3 @@ /*

setupFilesAfterEnv: [
'@testing-library/jest-dom',
'<rootDir>/jest/jest-setup-framework.js',

@@ -52,2 +53,4 @@ '<rootDir>/../../jest/stubInstUi.js',

'crypto-es': '<rootDir>/src/rce/__mocks__/_mockCryptoEs.ts',
'@instructure/studio-player':
'<rootDir>/__mocks__/@instructure/studio-player/_mockStudioPlayer.js',
},

@@ -65,5 +68,3 @@

],
plugins: [
['@babel/plugin-proposal-decorators', {legacy: true}],
],
plugins: [['@babel/plugin-proposal-decorators', {legacy: true}]],
},

@@ -70,0 +71,0 @@ ],

@@ -22,3 +22,8 @@ /*

import {StyleSheetTestUtils} from 'aphrodite'
// eslint-disable-next-line import/no-nodejs-modules
import {TextDecoder, TextEncoder} from 'util'
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder
/**

@@ -49,2 +54,11 @@ * We want to ensure errors and warnings get appropriate eyes. If

/Warning: Failed prop type: Invalid prop `color` of value `secondary` supplied to `CondensedButton`, expected one of \["primary","primary-inverse"\]./,
/ReactDOM.render is no longer supported in React 18/,
/Warning: Failed %s type: %s%s/,
/Warning: %s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.%s/,
/Warning: `ReactDOMTestUtils.act` is deprecated in favor of `React.act`. Import `act` from `react` instead of `react-dom\/test-utils`. See https:\/\/react.dev\/warnings\/react-dom-test-utils for more info./,
/Warning: `ReactDOMTestUtils.act` is deprecated in favor of `React.act`. Import `act` from `react` instead of `react-dom\/test-utils`./,
/Warning: unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https:\/\/reactjs.org\/link\/switch-to-createroot/,
/Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https:\/\/reactjs.org\/link\/strict-mode-find-node/,
/Warning: %s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext\(\) instead/,
/Warning: %s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext\(\) with static contextType instead./,
]

@@ -51,0 +65,0 @@ const globalWarn = global.console.warn

{
"name": "@instructure/canvas-rce",
"version": "5.13.6",
"version": "5.14.0",
"description": "A component wrapping Canvas's usage of Tinymce",

@@ -79,56 +79,56 @@ "main": "es/index.js",

"dependencies": {
"@instructure/canvas-theme": "^8",
"@instructure/canvas-theme": "8.56.4",
"@instructure/canvas-media": "*",
"@instructure/debounce": "^8",
"@instructure/emotion": "^8.39",
"@instructure/debounce": "8.56.4",
"@instructure/emotion": "8.56.4",
"@instructure/k5uploader": "*",
"@instructure/media-capture": "^9.0.0",
"@instructure/theme-registry": "^8",
"@instructure/ui-a11y-content": "^8",
"@instructure/ui-a11y-utils": "^8",
"@instructure/ui-alerts": "^8",
"@instructure/ui-avatar": "^8",
"@instructure/ui-badge": "^8",
"@instructure/ui-billboard": "^8",
"@instructure/ui-buttons": "^8",
"@instructure/ui-checkbox": "^8",
"@instructure/ui-code-editor": "^8",
"@instructure/ui-color-utils": "^8",
"@instructure/ui-file-drop": "^8",
"@instructure/ui-flex": "^8",
"@instructure/ui-focusable": "^8",
"@instructure/ui-form-field": "^8",
"@instructure/ui-grid": "^8",
"@instructure/ui-heading": "^8",
"@instructure/ui-icons": "^8",
"@instructure/ui-img": "^8",
"@instructure/ui-link": "^8",
"@instructure/ui-list": "^8",
"@instructure/theme-registry": "8.56.4",
"@instructure/ui-a11y-content": "8.56.4",
"@instructure/ui-a11y-utils": "8.56.4",
"@instructure/ui-alerts": "8.56.4",
"@instructure/ui-avatar": "8.56.4",
"@instructure/ui-badge": "8.56.4",
"@instructure/ui-billboard": "8.56.4",
"@instructure/ui-buttons": "8.56.4",
"@instructure/ui-checkbox": "8.56.4",
"@instructure/ui-source-code-editor": "8.56.4",
"@instructure/ui-color-utils": "8.56.4",
"@instructure/ui-file-drop": "8.56.4",
"@instructure/ui-flex": "8.56.4",
"@instructure/ui-focusable": "8.56.4",
"@instructure/ui-form-field": "8.56.4",
"@instructure/ui-grid": "8.56.4",
"@instructure/ui-heading": "8.56.4",
"@instructure/ui-icons": "8.56.4",
"@instructure/ui-img": "8.56.4",
"@instructure/ui-link": "8.56.4",
"@instructure/ui-list": "8.56.4",
"@instructure/ui-media-player": "^9.0.0",
"@instructure/ui-menu": "^8",
"@instructure/ui-modal": "^8",
"@instructure/ui-motion": "^8",
"@instructure/ui-number-input": "^8",
"@instructure/ui-overlays": "^8",
"@instructure/ui-pagination": "^8",
"@instructure/ui-popover": "^8",
"@instructure/ui-radio-input": "^8",
"@instructure/ui-react-utils": "^8",
"@instructure/ui-simple-select": "^8",
"@instructure/ui-spinner": "^8",
"@instructure/ui-svg-images": "^8",
"@instructure/ui-table": "^8",
"@instructure/ui-tabs": "^8",
"@instructure/ui-text-area": "^8",
"@instructure/ui-text-input": "^8",
"@instructure/ui-text": "^8",
"@instructure/ui-themes": "^8",
"@instructure/ui-toggle-details": "^8",
"@instructure/ui-tooltip": "^8",
"@instructure/ui-tray": "^8",
"@instructure/ui-tree-browser": "^8",
"@instructure/ui-truncate-text": "^8",
"@instructure/ui-utils": "^8",
"@instructure/ui-view": "^8",
"@instructure/uid": "^8",
"@instructure/ui-menu": "8.56.4",
"@instructure/ui-modal": "8.56.4",
"@instructure/ui-motion": "8.56.4",
"@instructure/ui-number-input": "8.56.4",
"@instructure/ui-overlays": "8.56.4",
"@instructure/ui-pagination": "8.56.4",
"@instructure/ui-popover": "8.56.4",
"@instructure/ui-radio-input": "8.56.4",
"@instructure/ui-react-utils": "8.56.4",
"@instructure/ui-simple-select": "8.56.4",
"@instructure/ui-spinner": "8.56.4",
"@instructure/ui-svg-images": "8.56.4",
"@instructure/ui-table": "8.56.4",
"@instructure/ui-tabs": "8.56.4",
"@instructure/ui-text-area": "8.56.4",
"@instructure/ui-text-input": "8.56.4",
"@instructure/ui-text": "8.56.4",
"@instructure/ui-themes": "8.56.4",
"@instructure/ui-toggle-details": "8.56.4",
"@instructure/ui-tooltip": "8.56.4",
"@instructure/ui-tray": "8.56.4",
"@instructure/ui-tree-browser": "8.56.4",
"@instructure/ui-truncate-text": "8.56.4",
"@instructure/ui-utils": "8.56.4",
"@instructure/ui-view": "8.56.4",
"@instructure/uid": "8.56.4",
"@sheerun/mutationobserver-shim": "^0.3.2",

@@ -153,6 +153,6 @@ "@tinymce/tinymce-react": "~3.8.4",

"prop-types": "^15",
"react": "^0.14.8 || ^15.0.0 || ^16",
"react": "^18",
"react-aria-live": "^2",
"react-color": "^2.13.4",
"react-dom": "^0.14.8 || ^15.0.0 || ^16",
"react-dom": "^18",
"react-draggable": "^3.3.0",

@@ -183,2 +183,3 @@ "react-redux": "^5",

"@testing-library/user-event": "^14",
"@types/testing-library__jest-dom": "^5.0.0",
"axe-testcafe": "^3",

@@ -185,0 +186,0 @@ "babel-loader": "^9.1.3",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc