Commit Graph

146 Commits

Author SHA1 Message Date
Ed Schiebel 4aa5d67d3a Add search to RCE's media tray
builds on LS-1235 and adds search to the media panel in the canvas
content tray

closes LS-1518
flag=rce_enhancements

test plan:
  - Having g/250818 and g/250994 included in your RCS is a prereq.
  - in the RCE open Media > Course|User|Group Media
  > expect all the docs in the tray
  - start typing in the search text input
  - type 2 characters and stop
  > expect nothing to happen
  > expect the tray to reload once you've typed at least 3 chars
  > expect the results to match the search string
  - clear the search text input
  > expect the tray to reload with all the documents

  - perform this on videos with their original title (which would be
    the file name), and with a video you've renamed in the Video Options
    tray. The search should locate the media based on your updated
    title

  - the Search box should not appear for Links

Change-Id: I10cd5007ad950f5c946bcc3cb0abb23326ca4ca6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250993
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-11-04 23:05:28 +00:00
Jackson Howe 78738b35b0 Show little placeholder when uploading image as link
When uploading an image, the user can choose to embed it in the rce,
or display the filename as a link which opens the image in a new
tab. When displaying as a link, the placeholder that appears while
uploading should be small since it will be replaced by a link, not a
large image.

flag=rce_enhancements
fixes LS-1557

Test plan:
 - Click 'Upload Image' in RCE and select an image from computer
 - Under attributes, select 'Display Text Link'
 - Click 'Submit'
 - While uploading (set network speed to slow if needed), a little
   placeholder (same size as the link text) should appear
 - Uploading images to embed should still show full size placeholder

Change-Id: I786a0c7d1d67a4142080efdefc1823743f22e566
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251668
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2020-11-04 20:21:47 +00:00
Ed Schiebel 7b6a7edbb6 Add search to images and documents in the RCE tray
closes LS-1235
flag=rce_enhancements

test plan:
  - Having g/250818 included in your RCS is a prereq.
  - in the RCE open Documents > Course|User|Group Documents
  > expect all the docs in the tray
  - start typing in the search text input
  - type 2 characters and stop
  > expect nothing to happen
  > expect the tray to reload once you've typed at least 3 chars
  > expect the results to match the search string
  - clear the search text input
  > expect the tray to reload with all the documents
  - repeat for images

  - the Search box should not appear for Links or Media

Change-Id: I5277ecfc9d2f25d2ec5ce673862f913b794e463d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/250765
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2020-10-26 15:15:37 +00:00
Ed Schiebel 89c51fc89b Better file URLs for viewing, not downloading
closes: LS-1265
flag=new_file_url_rewriting

- gets the verifier, if present, forwarded to the view ping-back url so
  it doesn't fail for one student viewing another student's file.
  Before, when clicking on a pdf and viewing it in canvadoc, the viewing
  of the file succeeds, but the ping-back to log access failed with a
  401. The pin-back now succeeds.
- gets the verifier added to the iframe src when the file is being
  viewed locally. You'll see this when stud1 views a .txt file from
  stud2. plain text files aren't canvadoc viewable, so they're viewed
  in a vanilla iframe.
- stops rewriting non /preview file URLs as download URLs.
  ?download_frd=1 is reserved for that. Before, when users deleted
  "/download" from a link using the html editor in the RCE, canvas put
  it back. Not any more. They shouldn't need to any more either,
  since...
- updates the RCE so links to files do not include /download in the
  URL.  When clicking on a file in the tray, the generated link no
  longer incfludes /download (and canvas won't put it back)
  Embedded images use /preview. Using Image Options to convert the
  image to a link removes /preview, and no longer replaces it with
  /download.

There's some weird file URL handling on in canvas. If the URL is
/preview, it is not logged as a page view. There are comments
indicating that /download will log access, though not always actually
download the file, and that download_frd is used for that. I found
this to be hard to confirm, /download seemed to download for me a lot.
It might be in conjunction with wrap=1, or the inline class name?

This change sets the "new_file_url_rewriting" flag, which enables
these changes, to on in ci and dev.
This change scares me a little and I really want to know that it's
OK.

test plan:
  - ensure new_file_url_rewriting is enabled (which it should be
    unless you're in test or prod environments)
  - it's nice to have canvadocs enabled too
  - do everything you can think of that revolves around files/attachments
    and make sure it still works. No, I/m not kidding

  - link files in the RCE
    - try file types that will be viewed in canvadocs (.pdf),
      in google docs (.rtf), and in a vanilla iffame (.txt)
  > expect clicking on the link to open the file in another tab
  - embed images in the RCE
  > expect the image to be shown, and the <img src> to be /preview
    (when loading a page with an image, the image will not show up in
     recent history, if that's on)
  - using Image Options, convert an image to a link
  > expect the image to be displayed in a new tab when the link is
    clicked
  - link a file, then add "download_frd=1" to the href's query_string
  > click on the link and expect the file to be downloaded, not viewed

  - I think there's some special handling WRT student submissions, so
    try all ^that in a submission.
  - All ^that should work if student1 links/embeds user files and
    images, then
  > expect student2 to be able to view them all
    (discussions are good for this)

  > expect existing content behavior to be the same as it ever was.

Change-Id: Ieae7e4daf549ececb982007b6ce97c8c091c099c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249094
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-10-21 18:48:33 +00:00
Jackson Howe 3cb624a863 Move embedding to separate plugin in rce
This removes the 'Embed' tab from the record/upload media modal and
places it in its own modal that can be launched from a separate
button in the menubar and toolbar.

fixes LS-1387
flag=rce_enhancements

Test plan:
 - Open the new RCE
 - Click record/upload media button
 - Expect modal to have 2 tabs - computer and record
 - Expect functionality to still work
 - Click Embed button and paste in an embed code
 - Expect embedding to work
 - Expect submit button to work only if text is present

Change-Id: I06f1fe81016f438c6dbf611aacf1250bfa214c7b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248951
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-10-05 18:13:04 +00:00
Ed Schiebel 77b361e382 Update how media player's iframe src is constructed
If the file data has and embedded_iframe_url, use it but add
a "type" url param.

If the file data has no embedded_iframe_url, but does have a
media_entry_id, use it to construct the url.

If there is no embedded_iframe_url or media_entry_id,
the mediahref url param is no longer
url encoded and includes only the files pathname.

In the last case, if the current URL includes a verifier param,
media_player_iframe_content copies it to the mediahref's value before
handing it to CanvasMediaPlayer.

closes LS-1501
flag=rce_enhancements

test plan
  - in the RCE upload or record a video
  > expect the player's iframe src to look like
    /media_objects_iframe/<the-media-id>?type=video
  - select a video from Course or User Media tray
  > expect the player's iframe src to look like
    /media_objects_iframe/<the-media-id>?type=video
  - upload a video file via Documents > Upload Document
  > expect the player's iframe src to look like
    /media_objects_iframe?mediahref=/courses/1/files/17?type=video
  - if you upload a file from Upload Documents as a student
  > expect the iframe src to include the file verifier
  - save
  > expect all the videos to be playable
  > expect the student video to be playable by another student

  - do it all again with audio
  > expect to get the audio player (it will have a mucical notes
    icon)

Change-Id: I632583b5238aae85445ffb88a38f09a79f749f18
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248774
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2020-10-03 16:23:53 +00:00
Ed Schiebel 42bdc51633 RCE View menu
closes: LS-1493
flag=rce_enhancements

test plan:
  - in the RCE, click View > Fullscreen from the menus
  > expect the RCE to fill the browser window
  > expect View > Raw HTML Editor to be disabled
  - click View > Fullscreen again (or type ESC, or type cmd-shift-F)
  > expect the RCE to return
  - click View > Raw HTML editor
  > expect the rce to flip to html edit mode
  - click the </> button in the RCE's status bar
  > expect the rce to flip back to wysiwyg mode

  - click in the fullscreen button in the RCE's status bar
  > expect the rce to go fullscreen

  - from the rce content area, TAB into the status bar
  - use the arrow keys to move focus thru the buttons
  > expect it to wrap around when you get to either end
  - with focus on any of the buttons, type TAB to leave the RCE
  - type shift TAB to return
  > expect focus to return to the same button that had focus before
  - click the html view button
  - type TAB to move focus to the status bar
  > expect focus to return to the </> button
  - use the arrow keys to move between the remaining 2 buttons
  > expect focus to wrap around
  - TAB out and bck in
  > expect focus to return to the button that had focus before

Change-Id: Ib327c0e19b56ed6461f0ce74d01cccd1c8c1f340
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248171
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-09-25 15:47:54 +00:00
Ed Schiebel 35b1cfe4a4 Show a spinner while images or media are uploading in the rce
While images or media are uploading, the RCE displays a grey box as a
placeholder for where the image/media will go. This didn't provide much
in the way of feedback that anything was happening.  This change adds
a spinner. Since we can't render instui components w/in tinymce, the
new-improved placeholder copied the instui Spinner's svg and css to
mostly replicate it from scratch.

As an added bonus tweak: before, if the user didn't like the newly
uploaded image and did "undo" do get rid of it, the first undo removed
the new image/media and put the placeholder back. It took a 2nd undo
to remove the placeholder. The placeholder is no longer part of the undo
stack so that doesn't happen.

closes LS-495
flag=rce_enhancemnts

test plan:
  - in the RCE, upload an image
  > expect the placeholder to have a spinner
  - undo (cmd-z)
  > expect the image to disappear and put you back to where
    you started w/o ever seeing the placeholder again.

  - repeat for a video
  > expect the same result.

Change-Id: I93a121638882bd1bc07745e40a9e6132d0563321
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247156
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-09-11 18:33:53 +00:00
Ed Schiebel 241d39ab2b Make file link URLs in the RCE uniform
- linked files have /download at the end of their path
  and wrap=1 in the query_string. This should cause a click to get the
  access logged by canvas and then preview it
- embedded files have /preview and no wrap=1, which should get it
  downloaded, not logged and not previewed which is needed for the
  <img> src attribute

There is some URL manipulation happening in the RCE that should be taken
care of in the RCS, but with the work happening here, we're not dependent
on an RCS update. That will likely come later (I have a commit in waiting)

closes LS-972
flag=rce_enhancements

test plan:
  - link files from all over the place in the RCE
  > expect them to have the prescribed URL shape
  - embed an image
  > expect it to show up

don't bother clicking on the links and expect the file to always be
previewed as expected. That needs to happen in another ticket.

Change-Id: I9eb587ad8af132257c8b371fcac1c7a8d0305405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/247225
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-09-11 18:33:35 +00:00
Jackson Howe 39f7666226 Remove canvas ENV dependency from canvas-rce
LS-1325 and LS-1219 introduced canvas dependencies into canvas-rce.
This commit passes the ENV.RICH_CONTENT_INST_RECORD_TAB_DISABLED
variable to rce as a prop.

flag=rce_enhancements
fixes LS-1330

Test plan:
 - Open an RCE
 - Media record should be available in toolbar and insert menu
 - In account settings, enable 'disable uploads to canvas media'
 - In RCE, expect to not see media record options in toolbar and
   insert menu

Change-Id: Ib766ceaa7884c2b6464bf6ad071686b1b38d53d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/245502
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2020-08-24 14:11:12 +00:00
Ed Schiebel ecb4ae6a57 RCE creates links to images and media when content is selected
Inserting images or media in the RCE from the tray typically embeds it, but
if the user has selected text, the text is getting replaced with the embed,
which is unexpected. This PS changes it so if there is something
selected, we create a link to it.

Except when uploading/recording/embedding. In that case the uploaded image
or uploaded, recorded, embedded media is embedded just after the selected
text.

We also update the CanvasMediaPlayer so that it correctly handles
being not in an iframe, but window.top, as is the case when
the user clicks on the created link

closes LS-1191
flag=rce_enhancements

test plan:
  - enter some text in the RCE
  - select some text
  - go to Media toolbar button and upload or record media
  > expect the media to be embedded in the content just after
    the selected text
  - repeat by uploading an image

  - select some text
  - go to Media toolbar button > User Media
  - select a media file
  > expect the selected text to be a link to the video
  - repeat using Image > Course or User Image

  - save
  - click on the media link
  > expect a new tab to open and show the media or image.
  > expect the player to look reasonable
  > expect resizing the window to work reasonably well. Tthere
    are some edge cases not accounted for. (portrait videos, if
    shrunk vertically don't grow when the window gets larger.
    landscape videos don't shrink in height when the browser is
    made short)
  - repeat for audio

  - click on the image link
  > expect the image to be downloaded (we have another ticket
    to make file links behave more uniformly)

Change-Id: I70ab14aaa593d48688d99b0ba006f60a300ed8a6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242726
Reviewed-by: Alex Anderson <raanderson@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-08-11 15:33:46 +00:00
Alex Anderson 3d000e88b2 Fix media upload being placed in the wrong place
When uploads take a long time to upload, it's possible for
the uploaded media to be inserted in the wrong place if
the cursor changes before the upload is complete. This
patchset stores a bookmark reference. When the upload
is complete and the upload is inserted in the editor, it
jumps back to the saved bookmark, inserts the image
and returns to where the cursor was.

Test plan:
With new RCE enabled
On a page, add several lines of text.
Get an image ready to upload
Open your network dev tools panel and
change the network speed from 'Online' to
'Slow 3G' - this makes it easier to change the
cursor before the upload is complete.
Start the upload
Quickly change the cursor to a different location
in your editor
Wait for the upload to complete.
The image should have inserted at the location
where the cursor was before the upload was started

flag=rce_enhancements

Fixes LS-1233

Change-Id: If5d70989586214f22dbee998fdf655c603ef8ee0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243861
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Alex Anderson <raanderson@instructure.com>
2020-08-06 14:58:34 +00:00
Ed Schiebel d554f3e3fa Encode filename before setting as data attribute value
If a filename includes quotes, setting it as the value of the
data-placeholder-for attribute results in nested quotes which
causes all kinds of problems.  urlencoding the filename for
this attribute solves the problem

closes LS-1196
flag=rce_enhancements

test plan:
  - upload an image whose filename includes quotes
  > expect the gray placeholder to get removed and the image
    to be put in its place
  - Do Images > Course/User Images and select the file with quotes
  > expect it to get properly embedded in the rce

Change-Id: I8044f352e3bf0063c7be8241dc6258c07fd17acc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242816
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2020-07-27 15:23:55 +00:00
Ed Schiebel d90c375107 Update RCE autosave when editing in html view
Adds an autosave update in the textarea's onchange handler.
Removes the window unload handler, since it was not getting called anyway

closes LS-1074
flag=rce_auto_save

test plan:
  - follow the recreate steps in the ticket, because
     the syllabus edit page is different from other edit pages
  - on re-editing
    > expect not to get prompted for autosaved content
    > expect the RCE text to be everything you entered last time
  - on any other RCE page (edit assignment, announcement, ...
  - enter some text in the rce
  - flip to html mode and enter some more
  - leave w/o saving (refresh or cancel)
  - edit again
  > expect to be prompted with autosaved content that contains
    everything you entered.
  - flip to html mode and enter some more text
  - save
  > expect the saved item to have all the text
  - edit again
  > expect not to be prompted with autosaved content

Change-Id: I860ebf290ff1494dcf060176041d5e350c1771b0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243011
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Anderson <raanderson@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-07-22 19:47:09 +00:00
Ed Schiebel a3219c3d60 Do not set RCE images to be so small
In the old RCE, images were added and let the prevailing CSS
constrain the width to 100%.  With COREFE-241, I incorrectly
thought that was poor UX and constrained the images to be 320px
on the long side when first embedded. Turns out I was wrong.
This change reverts that and lets the images be their natural size,
subject to the 100% max-width constraint, just like the old RCE

closes LA-1127
flag = rce_enhancements

test plan:
  - add a large photo to the RCE
  > expect it to be constrained in size only by the width of
    the RCE
  > expect the RCE's height to expand to the eventual rendered
    size of the image, and not the image's _real_ height
  - save
  > expect the same result
  - edit again
  - use the Image Options tray or drag handles to change
    its size
  > expect it to respect the new size
  - save
  > expect it to look like it did before

Change-Id: I9046f1fd2d9dd3af7435e75ff30bc1031e823f02
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239976
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-06-16 12:31:47 +00:00
Ed Schiebel 67967c089d Treat RCE uploaded SVG files as images
There are a couple places in canvas doesn't treat uploaded svg files
as images. When returned from the files api, svg files are missing
a thumbnail url, and the response from canvas on uploading an svg file
misclassified it as a 'file' and not an 'image'

This commit reverts some generalization introduced into mime class categorization.
In an attempt to keep from having to play whack-a-mole with new mime types, I had
introduced changes where anything "image/*" was an image, and the same for "audio/*"
and "video/*", but there are a _lot_ of types I didn't consider that we wouldn't
be able to handle. For example, safari doesn't handle image/webp, so we shouldn't
yet treat that as an image file type.

closes LA-860
flag = rce_enhancements

test plan:
  - in the RCE, upload an svg file
  > expect it to be previewed in the image > upload dialog
  > expect it to be embedded (not linked) in the RCE
  - inspect the "create_success" network request's response
  > expect the returned "mime_class" to be "image"

  - from images > user or course images
  > expect the tray to display the svg
  - select the svg
  > expect it to be embedded, not linked

  - from media > record and upload, record audio
  > expect it to show up in the rce as the embedded
    audio player, and not as a link (this confirms
    a fix from an earlier ticket wasn't broken)

Change-Id: I6a2b27550c674555e4f62a97a18091467d094b71
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239633
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-06-11 21:59:46 +00:00
Ed Schiebel f191b15228 Delete unused rce sidebar files from the new rce
closes LA-255
flag=rce_enhancements

test plan:
  - specs all pass
  - the rce still works

Change-Id: Ib33fc1e69d45ce27d36cab4930a6a1afda5b3f8b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/239373
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-06-09 22:20:11 +00:00
Ed Schiebel c603d6e9f2 fix audio player and video player sizing
closes LA-729
flag=rce_enhancements

The original intent for the audio player was to size it so the buttons
just fit. This ignored the fact that it's rendered w/in an iframe,
so popup menus are clipped. This change sizes the player to leave
room for those popups.

While the ticket was written against the audio player, the same issues
may occur in the video player, either for portrait videos or videos < 400px
wide when closed captions are present.  The original code for
sizing the video player shrank the width to fit
thea video's size, which clipped the buttons. This change sets a minimum
width for the player and letter-boxes the video.

test plan:
  - in the new rce
  - add an audio file
  > expect it to be wide enough to show all the buttons and
    tall enough for the speed and volume popups

  - add a vertical video
  > expect the video sized to fit in the available space in the Computer
    tab of the Upload Media modal
  - Submit to upload
  > expect the player to be wide enough to show all the buttons
  - click the fullscreen button
  > expect the video to be the height of the screen and letterboxed
  - restore to windowed size
  > expect the video to return to its letterboxed size
  - click the video, then the Options button
  - change the video's size
  > expect the video to remain letterboxed

  - add a horizontal video
  > expect the video sized to fit in the available space in the Computer
    tab of the Upload Media modal
  - submit to upload
  > expect the player to be sized to the size of the video
  - fullscreen
  > expect the video to be letterboxed in the fullscreen player
    (if the aspect ration of the video !== that of your monitor,
     or fill the screen if they match)

  - for the horizontal video, select Opitons and
    change the size to be "medium" or "custom" and < 400px wide
    and add subtitles
  > expect the video to be letterboxed in a 400px wide iframe.

Change-Id: Ib5d08dbd7796985d00f656e38a642ab92939d614
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238432
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Anderson <raanderson@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-06-04 12:58:00 +00:00
Ed Schiebel bdc62d59a8 Wire CC UI to the API
closes LA-463
flag=cc_in_rce_video_tray

This change:
1. updates the closed-caption handling w/in the object that handle them
   so that their properties don't change depending on where you are.
   For the most part, this meant using locale as the unique identifier.
2. Adds the current tracks to the video options passed to the
   VideoOtionTray
3. Adds an api call to update media_tracks on saving changes from the
   VideoOptionsTray
4. refreshes the iframe containing the media player after updates
   complete. This updates the tracks on the contained <video>
   element
5. As add closed captions in a language, that language is removed
   from the Select when adding more.

test plan:
  - upload a video using RCS
  - add closed captions in at least 1 language
   (it doesn't matter whether the .srt file is in
    the right lang. no one checks)
  > as you add languages, expect them to be removed
    from the list of available languages in the
    language Select
  > expect the CC button on the resulting video in
    the rce with the right languages in the popup
    menu
  - click on the video, then the Options button
  > expect the Video Options tray to include the
    closes captions you added
  - replace some, delete some, add some
  - click Done
  > expect the CC menu in the video to include the
    updated list of captions
  - click on the video, then the Options button
  - check the "Display text link" checkbox
  - edit the closed captions
  - click Done
  > expect a link to the movie in the RCE now
  - right-click on the link and select open in a new window|tab
  > expect the video in the new window|tab to have the updated
    closed caption list when you click the CC button

Change-Id: Ie2b51708a7390c47dfcf5ab2b2dbfd9e998fbf86
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/227691
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2020-05-07 18:16:21 +00:00
Ed Schiebel 0ebf876f7a Respect user's selection when creating links in the RCE
closes LA-508
flag=rce_enhancements

test plan:
  The problem described in the ticket:
  - in an rce, type in some text, select some text
  - choose Documents > Upload Document
  - upload a file
  > expect the created link to use the selected text,
    not replace it
  Related fixed issues
  - select some text
  - choose Links > Course Links
  - pick something (Course Navigation is always populated)
  > expect the created link to use the selected text
  - this should work for images and files also (media is always
    embedded)

  - with a selected link, try creating another link like above
  > the link's href is updated, but the selected text remains
    the same

Change-Id: Ia2d419cb07b779e02677b28b60973d1daf53932c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/227979
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
2020-05-01 13:52:59 +00:00
Ed Schiebel dfac0ff66a better media upload error handling
The user can no longer leave a page while media is uploading
If media upload fails, the user gets an error message

closes: LA-759
flag=none

test plan:
  - in the RCE, upload some media (maybe have your network throttled
    so the upload is slow)
  - try to leave the page
  > expect to be prompted whether you really want to leave the page
  - say no
  > expect to be left on the page
  - say yes
  > expect to leave the page

  - in the RCE, upload some meddia, but cause it to fail
  > expect an error message in the RCE
  > expect the grey placeholder to be removed

Change-Id: I447e232f6bc0801249fa2b7fd92314716dbc95e3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233902
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-04-17 17:56:36 +00:00
Ed Schiebel 1271571e3e fix error with unexpected audio mime-type
we were looking for audio and video mime-types from a list. when
recording on a mac, the type wasn't in our list. This change
generalized the check by considering mime-type starting with "audio"
to be audio, and "video" to be video.

closes LA-868
refs LA-595
flag=none

test plan:
  You'll need notorious running
  in chrome
  With RCE Enhancements turned off and again with it on
  - in the RCE select Media > upload/record media
  - go to the record tab
  - record a video
  > expect it to be in the RCE
  - repeat, but in the Record tab, click on the "webcam"
    button and select "No Video"
  - record some audio
  > expect it to be in the RCE
  - save
  > expect to be able to play both.

  - go to an assignment's submission
  - go to speedgrader
  - add a media comment
  - record audio
  - do it again for video
  > expect the comments to be viewable



Change-Id: If2cdfd4dd689569ac539a079f270bd789f37a502
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/231542
QA-Review: Anju Reddy <areddy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-04-04 12:51:29 +00:00
Ed Schiebel 211b7c1c0e Handle inst-fs uploads from the rce
the previous flow lost track of the file verifier, causing
users not to be able to view other user's images/files

closes LA-745
flag=none

test plan:
  - in an environment where file uploads to go inst-fs*
  - create a discussion
  - as Student A, add a reply including an uploaded image
  - as Student B, or the Teacher, view the discussion
  > expect the image to be rendered
  > if you look at the <img>, the src attribute should include
    the verifier parameter.
  - more scenarios from the acceptance criteria in the ticket

*I might be able to help you get this setup locally.

Change-Id: I2bf707f0f1f8a29cd8e5d224a962f8ef515f4a9e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229433
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-03-13 20:25:55 +00:00
Ed Schiebel 417fc616a3 Restore <img> upload placeholder in the RCE
closes LA-698
flag=rce_enhancements

test plan:
  - edit something with the rce
  - add some text
  - using devtools, slow down your network (this will give you
    time later)
  - upload an image (or anything, really)
  > expect the grey placeholder box
  - refresh (before the image replaces the placeholder)
  > expect to be prompted to restore autosaved content
  - say yes
  > expect the RCE not to have the placeholder image

Change-Id: I79211fa8daa77d51ff15e73563dcce48103cbdb8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228721
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-03-09 15:32:39 +00:00
Ed Schiebel 8d697d722e new improved rce URL handling
this moves the locations where swizzling of the file
url takes place to be more uniform whether the file
is being uploaded or selected from the tray.
I also adjusts the url of an image depending on whether
it's linked or embedded so it's displayed (and not
counted as a view) or downloaded (which is logged
as a view)

to test this, you will also need the changes to the RCS
in g/225943

closes LA-585
flag=rce_enhancements

test plan:
 - as a teacher in a course, create anything with the rce
 - insert an image you upload
 - insert a Course image
 - insert a User image
 - insert another image and use Options to convert it to a link
 - insert a document you upload
 - insert a course document
 - insert a user document
 - save
 - view the item as a student
 > expect to see all the images
 - click on each of the links
 > expect you to have access.
   > right click on an image > View Image will download
     (same as old rce)
   > the link to the image will download (new to new rce)
   > the link to the uploaded document will open in canvas' files page
     (same as old rce)
   > the link to the course file will open in canvas' files page
     (same as old rce)
   > the link to the user file will be displayed right in the browser
     assuming the browser can display the file type
     (new to new rce)

 - repeat, but as a student create a discussion topic
 - view the discussion as another student
 > expect to see all the images and be able to access all the links

Change-Id: I6fe7e77250082e6f4ddfc3fba7def9655a5c2b49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/225781
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2020-02-14 15:16:37 +00:00
Ed Schiebel 80b3bd0c7c Change rce's upload placeholder
The previous placeholder was an <img src="data:image/gif...">. When
autosave saved it, it got saved as an <img src="blob:...">, which
cannot be restored. By changing it to a <div>, the problem goes away.
The only side-effect is that if the upload fails and the user wants
to delete the placeholder, it used to take one click of the BS key.
Now they have to delete the "Loading..." text and the <div> will
eventually go with it.

closes LA-475
flag=rce_enhancements

test plan:
  - with notorious not running
  - in the RCE, upload media
  > expect the "Loading..." grey placeholder box
  - refresh the page
  > expect to be prompted with auto-saved content
  - say Yes
  > expect the grey box in the RCE
  - iwth notorious running
  - in the RCE, upload media
  > expect the "Loading..." grey box
  > expect the grey box to go away once the media appears

Change-Id: If16037b4b3310eb8bdc8212bc1ed1d8dc83b657d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/224433
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Reviewed-by: Carl Kibler <ckibler@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-02-01 14:54:06 +00:00
Ed Schiebel 9921eac4a8 Fix RCE file link issues
1. files uploaded via the rce are now recognized as previewable
   and get the preview icon after saved
2. files linked to from the tray are viewed w/in canvas Files
   page when clicked
3. images converted to links open w/in the canvas Files
   page when clicked
4. media still opens in a new tab with the viewer, but is not
   wrapped in the canvas Files page

closes LA-447
flag=rce_enhancements

test plan:
  - in the RCE
  - using Documents > Upload Document,
    upload a previewable file (e.g. .txt, .pdf)
  - using Documents > Course Documents, add a link
    to the same file
  - save
  > expect both links
    a) to have the preview icon next to the link
    b) clicking the preview icon loads the preview
       (note: since this is done via the google doc viewer,
       google won't be able to link back to your local canvas
       so the preview will be blank)
    c) clicking on each link should load the file in the canvas
       Files page in a new tab
  - repeat with images, but after adding to the RCE, use the
    Options tray to change display to a link, changing
    the alt text.
  > expect the link text to be the image's alt text
  > expect clicking on the links to open the image in the
    canvas Files page in a new tab

Change-Id: Ib182bf93a5a2a0b4450c52ab3833d69b3fa0e0fd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222929
Reviewed-by: Carl Kibler <ckibler@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-01-16 00:09:45 +00:00
Ed Schiebel 4131b38b78 Implement sorting of rce tray content in images panel
requires the sorting of documents panel to be merged first

closes LA-111
flag=rce_enhancement

test plan:
  - have a course with some image files
  - create a new assignment or announcement (to get the rce)
  - from toolbar select Images > Course Images
  > expect the images to be sorted by
    created_at date in descending order
  - change sort by from Date Added to Name
  > expect the images to be listed by file name ascending

Change-Id: Ic29d901f614feb31faebc874d3715b0bff5e143e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/221834
Tested-by: Lauren Williams <lcwilliams@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-01-07 00:28:04 +00:00
Ed Schiebel c4ba2409d6 Implement sorting of rce tray content in media panel
requires the sorting of documents panel to be merged first

closes LA-111
flag=rce_enhancement

test plan:
  - have a course with come files
  - create a new assignment or announcement (to get the rce)
  - from toolbar select Media > Media Documents
  > expect the media files to be listed by
    created_at date in descending order
  - change sort by from Date Added to Name
  > expect the files to be listed by name ascending
  - switch to documents
  > expect the documents to be sorted by name ascendingw

Change-Id: If51a90507b97572f62dabbde8e692ddf7d13829e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/221840
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2020-01-06 23:13:28 +00:00
Ed Schiebel 7e161af9d6 Implement sorting of rce tray content in documents panel
closes LA-111
flag=rce_enhancement

test plan:
  - have a course with come files
  - create a new assignment or announcement (to get the rce)
  - from toolbar select Documents > Course Documents
  > expect the non-image or media files to be listed by
    created_at date in descending order
  - change sort by from Date Added to Name
  > expect the files to be listed by name ascending

Change-Id: I0a16958aab544624548cc9d73881109f9259161a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/221757
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2020-01-06 23:12:07 +00:00
Ed Schiebel 461e3f9a95 Push edits to the video title to canvas db
closes LA-242
flag=rce_enhancements

test plan:
  - insert a video into the rce
  - click on it and then the Options button
  - update the title in the video options tray
  - click Done
  > expect to see a PUT request sending the new title to
    canvas via the RCE
  - stop the RCS api and update the title again
  > expect to see a couple alerts telling you something went wrong
  - query the media_objects api at
    /api/v1/media_objects?exclude[]=sources&exclude[]=tracks
  > expect to see the video with it's updated title

Change-Id: Ic334866703a1e48ecd86c4f717ce736f419dd67e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218603
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-12-20 19:34:43 +00:00
Ed Schiebel 7a112cf835 Fetch subsequent pages of images
closes LA-284
flag=none

test plan:
  - to make this easier, in canvas-rce-api/app/api/wrapCanvas.js,
    change DEFAULT_CANVAS_PER_PAGE_ARG=5 (from 50) and restart
    canvas-rce-api
  - with a user that has many images, open a page with the rce
  - choose Images > [Course|My] Images
  > expect a page of images and a load more button
  - click "Load More"
  > expect new and different images to get loaded

Change-Id: I2196085ec6f840a3f8561a3a5097792b4d747996
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/221251
Tested-by: Jenkins
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-12-18 23:47:14 +00:00
Ed Schiebel 82f3603f95 Add Embed tab to Upload Media modal
closes LA-109
formerly COREFE-325

test plan:
  - load up the RCE
  - click on Media > Upload/Record medoa
  - select the Embed tab
  - enter some embed code in the textarea
    I copied this from youtube:
<iframe width="560" height="315" src="https://www.youtube.com/embed/Nuzi7LlSDVo"
frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
  > expect the Jon Oliver video in the RCE
  > expect the yellow box highlighting the video to be the right size
  - you can actually put anything in the textarea and it will show up in
    the RCE, as if you typed it in the HTML view. You should test typing
    in the textarea too, since there is some bad interaction between
    the TextArea and the Tabs I worked around.

Change-Id: I3225ae192ca054becb03f570e34d30817c06faec
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/211690
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-11-05 19:23:53 +00:00
Ed Schiebel 67e551c5e5 Add video options tray to the rce
closes COREFE-315

test plan:
  - load a page with the RCE and have a video in it
  - click on the video
  > expect the Options popup toolbar button
  - click it
  > expect the video options tray to open
  > expect the title to default to the video's file name
  > expect the default size to be Large (400px on the long side)
  - delete the title
  > expect the Done button to be disabled
  - set a new title
  - change the size to Custom
  - delete the width or height
  > expect an error message and the Done button to
    be disabled
  - enter a new size, or select one from the dropdown
  - click Done
  > expect the video to be resized to the new size
  - if you're using a screenreader, expect the video
    to be announced as "Video player for {your title}"

Change-Id: Id7e29520cc91c02645b92d666216e64f6619bbbb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/211355
Product-Review: Lauren Williams <lcwilliams@instructure.com>
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2019-10-30 13:14:42 +00:00
Clay Diffrient 946ef4b275 Run prettier on packages/
Test Plan:
  - Automated tests pass

refs COREFE-347

flag = none

Change-Id: I573a1dff4f90b0d68fee8d0f261b50a60c7a3fbb
Reviewed-on: https://gerrit.instructure.com/212768
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-10-11 19:29:16 +00:00
Ed Schiebel 661713eb2c Add support for audio type media to the RCE
closes COREFE-313

test plan:
  - have a user and a course with video and audio files
  - from the rce select course|user media and choose a video
    or  select media > upload and pick a video file
    > in both cases, expect the video to be embedded
      in the rce, scaled to be 400px wide while
      maintaining the correct aspect ratio
 - repeat with audio
   > expect the autio player to be sized just large
     enough for the buttons
 - save the content
 > expect the audio and video to be in the saved page
 - edit again
 > expect the audio and video to be in the rce

In response to a code review comment, the ComputerPanel focus
handling and VideoPlayer sizing got factored out into
custom hooks.
  - Select Documents > Upload Document
  - select a file
  > expect focus to go to the trash-can button
  - repeat with Media > Upload Media

  - Select Documents > Upload Document
  - select a video file
  > expect the video to be sized to ~75% the width
    of the modal
  - insert the video in the RCE
  > expect it to be 400px wide
    and the corresponding height to maintain
    its aspect ratio
  - repeat for Media > Upload Media

Change-Id: Ifad3c5bbe162061aa07620d244ece0769da29afd
Reviewed-on: https://gerrit.instructure.com/210265
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
2019-10-07 19:32:09 +00:00
Ed Schiebel d5a80a41a9 Update media upload
closes COREFE-268

test plan:
  - open a page with the rce
  - from the media toolbar button menu, select upload
  - pick a video from your computer
  > expect a preview to appear
    > expect the video to be about 75% the width of the modal
      and as tall as it needs to be for the video
  - click Submit
  > expect the modal to close
  > expect the video to show up in the rce
    > expect it to be 400px wide, and however tall it needs
      to be (try both portrait and landscape videos)
    > expect the grey placeholder while it's being uploaded
    > expect the yellow flash indicator when it's loaded
    > expect to see a "Loading..." message until the video player
      renders
  - from the documents toolbar button menu, select upload
    and upload a video
  > expect the video file to show up in the media>course media
    tray list
  - click on the video file
  > expect the video to show up in the rce
    > and for all the same constraints as the uploaded
      video to be true

  - you should try this with the video appended to the end of
    content and right in the middle
  - click on a video and delete.

  - if you loaded the page via http, there will probably be
    no fullscreen button

Change-Id: I934ad486b74689e81941e1fcf0cf6efd18e5f426
Reviewed-on: https://gerrit.instructure.com/209296
Tested-by: Jenkins
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2019-09-30 14:13:50 +00:00
Ed Schiebel 56d8210984 Render media files in the CanvasContentTray
The files are there, though the visuals are incorrect. I just
lifted the documents Link component to get them displayed.
Rendering per the design will be a later ticket

closes COREFE-40

test plan:
  - load the rce in a course as a teacher
  - select Media > Course Media
  > expect course audio and video files displayed in the tray
  - switch to My Files
  > expect user audio and video files in the tray
  > expect the files to have their respective icons

  - load the rce in a course as a student
  - select Media > My Media (expect it to be the only option)
  > expect the students media files to be diplayed in the tray
  > expect Course Files not to be an option

Change-Id: I8836c4e207163b6e0c0dff0d68be12d819ca5bc6
Reviewed-on: https://gerrit.instructure.com/207042
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-09-17 16:51:58 +00:00
Ed Schiebel bad38d2e9e Constrain the size of images inserted into the rce
when the user first inserts an image from the tray, constrain its size.

closes COREFE-241

test plan:
  - load a page with the rce
  - have a relatively large image in the course images
  - insert the image into the rce
  > expect it's size to be constrained so neither edge is > 320px
  - select the image, and click Options
  > expect the Custom image size should reflect the correct current
    size of the image
  - change the image size and click Done
  > expect the image to be resized
  - add the image again
  - save what you're working on
  > expect the images to keep their set sizes
  - edit again
  - in html view, add a style attribute, and any other attributes
    to the <img> element
  - flip back to rich view
  > expect the image to look like you'd expect, given what you just did
  - change the image size in the tray
  > expect your custom style and other attributes to be preserved
  - upload landscape image that's wider than 320px
  > expect the grey placeholder box to be right-sized to 320 wide
  > expect the image to be right-sized when it replaces the placeholder
  - repeat, uploading a landscape file taller than 320px

Change-Id: I4aa3893eda846e82775c658fd51b7b8d796b2ec0
Reviewed-on: https://gerrit.instructure.com/207492
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-09-05 23:50:50 +00:00
Ed Schiebel bd2211f35d User and Course Images
closes COREFE-203

Adds ability for a teacher to switch between course and user files.
Changes the images query logic to piggyback on the /documents api
so docuents, media, and images will all share the same query logic

test plan:
  - have a course with some images
  - have a teacher and a student with personal images

  - go to the course as a teacher
  > expect rce images toolbar button menus to
    show Upload, Course images, and My images
  - upload an image
  > expect it to succeed
  > expect the new image to appear in the Course images
    tray
  > expect the images to appear in the course's upload media  folder

  - select My Images from the toolbar menu
  > expect my Images to be shown in the tray
  - use the filter to switch to Course Images
  > expect course Images to be shown in the tray
  - repeat, starting with Course Images and flipping to My Images

  - go to the course as a student
  > expect rce Images toolbar button menus to
    show Upload and My Images
  - upload Image(s)
  > expect it to succeed
  > expect the new imsges to appear in the user's file page's
    My Files (/files).
  > do NOT expect the imsges to show up in the course's Files page
    (/courses/:id/files)
  - click on Images > My Images
  > expect to see Links and My Images in the top select of the tray
  > do NOT expect to see the Course Files option in tray

Change-Id: If7f4e6b6f90b445e497be81b9cb940da71a8cf74
Reviewed-on: https://gerrit.instructure.com/206788
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-09-05 15:28:54 +00:00
Ed Schiebel 5403f8c208 Remove depencendy on Sidebar components from new rce
closes COREFE-245

test plan:
  - it still builds
  - all the tests stil pass

Change-Id: I3838e43eb11a2cac213e28f1bfac326bf21f9891
Reviewed-on: https://gerrit.instructure.com/207861
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-09-03 21:17:29 +00:00
Ed Schiebel ae81fee438 Support User and Course documents in the rce
Images are still course only. Will be addressed in the text ticket

closes COREFE-204

test plan:
  - have a course with some files
  - have a teacher and a student with personal files

  - go to the course as a teacher
  > expect rce Documents toolbar button menu to
    show Upload, Course Documents, and My Documents
  - upload document(s)
  > expect it to succeed
  > expect the new files to appear in the Course Documents
    tray
  > expect the files to appear in the course's files folder
    (/courses/:id/files)

  - select My Documents from the toolbar menu
  > expect my documents to be shown in the tray
  - use the filter to switch to Course Documents
  > expect course documents to be shown in the tray
  - repeat, starting with Course documents and flipping to My documents

  - go to the course as a student
  > expect rce Documents toolbar button menus to
    show Upload and My Documents only
  - upload document(s)
  > expect it to succeed
  > expect the new files to appear in the user's file page's
    My Files (/files).
  > do NOT expect the files to show up in the course's Files page
    (/courses/:id/files)

Change-Id: I279e46ef422a8895e1f38688d98ceabfc5f9ce88
Reviewed-on: https://gerrit.instructure.com/205359
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-08-27 17:45:57 +00:00
Ryan Shaw 78a25bf4e8 [codemod] convert functions to fat arrows
This is the result of running:

jscodeshift -t ../js-codemod/transforms/arrow-function.js .

see: https://github.com/cpojer/js-codemod#arrow-function

Transforms callbacks only when it can guarantee it won't break this 
context in the function. 
Also transforms function() { }.bind(this) calls to () => {}.

jscodeshift -t js-codemod/transforms/arrow-function.js <file>


Change-Id: I04d20c818002b3dce5a43d8e91f01d904f966706
Reviewed-on: https://gerrit.instructure.com/205785
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-08-26 22:20:33 +00:00
Ryan Shaw afa9bfc624 fix a deprecation from sinon.sandbox
We get a lot of these in our logs:
`sandbox.create()` is deprecated. Use default sandbox at `sinon.sandbox`
or create new sandboxes with `sinon.createSandbox()`'

This should fix that

Change-Id: I3fda9d219dbcc768405763876924eef16d0d1c9b
Reviewed-on: https://gerrit.instructure.com/206013
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-08-21 16:04:42 +00:00
Clay Diffrient 9869118d38 Add error handling to the RCE
This makes it so that RCE errors get surfaced in a
visible and actionable location when they occur.

Test Plan:
  - Precondition: Do NOT have canvas-rce-api running
  - Go to an instance of an RCE
  - Try and upload a picture
  - Above the RCE you should see an error message.

closes COREFE-8
closes COREFE-9

flag = rce_enhancements

Change-Id: Icde2dd386da45d7d47dcda24fcddb04156749835
Reviewed-on: https://gerrit.instructure.com/204022
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-08-19 15:33:43 +00:00
Ryan Shaw 1d199b5e2f upgrade eslint & don’t use unique one in canvas-rce
instead of having our own eslint in canvas-rce, and maintaining all
future rules like react hooks and stuff we can just use the same one
that the rest of the repo uses.

test plan:
* cd packages/canvas-rce
* `yarn lint` should run

Change-Id: Idbe8af533f7a19035d1998538d2d6fd1a711f164
Reviewed-on: https://gerrit.instructure.com/204998
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-08-15 17:17:30 +00:00
Ed Schiebel 6ccad53796 return focus to the status bar buttons
when the kb shortcut dialog or the a11y checker tray close,
return focus to the button that opened it.

closes COREFE-108

test plan:
  - in rce, click on the kb short cutton in the status bar
  - close the kb shortcut dialog
  > expect focus to return to the button
  - repeat for the a11y checker
  - tab until the show-on-focus kb shortcut button above the RCE
    appears, click it, then close the dialog
  > expect focus to return to the button

Change-Id: I27ea79930e643d9908a784fbcb89900918d3be01
Reviewed-on: https://gerrit.instructure.com/204283
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-08-13 16:06:49 +00:00
Ed Schiebel d18dba5caf correctly handle rce focus on dialogs closing
closes CORE-3192

the easiest way to test this is by using the Assignments 2
TeacherView page, since the RCE will fold up and disappear
when it blurs. This change fixes a bug where what wouldn't
happen once a dialog was opened.

test plan:
  - enable Assignment 2 and open an assignment (this should put
    you in the Assignments 2 Teacher View)
  - click on the pencil to edit the description
  - from the rce toolbar, select Links > external links
  - set the text and url and click Done
  > expect the dialog to close, focus to return to the RCE, and for
    the RCE to still be visible
  - tab until you leave the RCE
  > expect the RCE to disappear and be replaced by the description
  - click in the description to get the RCE back
  - put the cursor in the link and select Links > Edit Link, the close
    the dialog
  > expect focus to return to the RCE, and for the RCE to still be
    visible
  - tab out of the RCE
  > expect the RCE to disappear.
  - edit the description again
  - select Documents > Upload Document
  - select a file and click "Submit"
  > expect the dialog to close, focus to return to the RCE, and for
    the RCE to still be visible
  - tab out of the rce
  > expect the rce to disappear
  - edit the description again
  - select Documents > Course Documents
  - click on a document
  > expect the tray to close, focus to return to the RCE, and for
    the RCE to still be visible
  - tab out of the RCE
  > expect the RCE to disappear

Change-Id: I8c5cfdd85fc7e460180256cd2453091284710661
Reviewed-on: https://gerrit.instructure.com/201585
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2019-08-01 15:55:19 +00:00
Ed Schiebel 5e5120e566 Give RCEWrapper onFocus/onBlur handlers
closes ADMIN-2742

there are challanges
- RCEWrapper keeps track of whether it has focus. This is true if
  anything w/in its outermost div is the activeElement
- since the previously active element blurs
  before the new element becomes active. we need a timeout to wait and
  see where focus lands. this is true when:
  - focus moves to a tinymce popup, like a menu
  - focus moves to one of RCE's dialogs or trays
  - the user interacts with content in the CanvasContentTray. This
    is because a new instance of the CCT is created every time it
    renders as the user interacts with it. (An artifact of how it's
    wired into redux).

This also addresses a bug where the html-view textarea was the wrong
size when flipping between rich text and html views.

NOTE: if you close any of the Trays or Modals by typing "esc", it will
blur the RCE. This is a known bug that I'm hoping will be fixed
via INSTUi-2201. If not, then via another CORE ticket

test plan:
  - not necessary, but if you test in assignments2, you'll know it's
    working because the RCE will go away if it loses focus,
    so enable assignments2, create an assignment, then
    edit the assignment (you can't create an a2 assignment yet)
  - insert and edit an external link
  - insert and edit a course image
  - upload an image
  - insert and edit a course document
  - upload a document
  > in each case, expect focus to return to the RCE, and if applicable,
    the yellow indicator box is correctly positioned.
  - in any of the above cases, click on the yellow indicator while it's
    visible
  > expect focus to stay w/in the rce

  resizing:
  - click the "switch to html view" button
  > expect the textarea to fill the avaiable space
  - resize it and click the button to switch back
  > expect the rce to be the same (or really close) size

Change-Id: If85c5644558fbce27530e43bb71c2bdb7e91eb12
Reviewed-on: https://gerrit.instructure.com/199273
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-07-05 21:22:37 +00:00
Ed Schiebel 0500498436 Update link editing
Sadly, in an attempt to fix the test problem, + a change in how embedded
documents were going to work, this change started from scratch, losing
the history of the tray code that is a modification of earlier work from
CORE-2665 and https://gerrit.instructure.com/c/canvas-lms/+/197101

closes CORE-2698

test plan:
  - edit or create an assignment
  External Links
  - from the rce toolbar, select Links > External links
  > expect the insert/edit link dialog
  - fill in the form and click Save
  > expect a link with your provided url and text,
    target='_blank' and rel='noopener noreferrer'
  - put your cursor in the link
  > expect the Links toolbar button to be highlighted
  - click Links > Edit Link
  > expect the links dialog
  - change something and save
  > expect your change to be reflected in the link

  Course Links
  - from the toolbar select Links > Course Links
  > expect the canvas content tray to open, set to Links
  - expand one of the sections
  - click on a course item
  > expect the tray to close
  > expect a link to the item in the rce
  > expect a yellow box to temporarily highlight the link
  - from the toolbar select Links > Edit Link
  > expect the edit link dialog
  - change the text and save
  > expect the link to reflect your change

  Course Documents
  - from the toolbar select Documents > Course Documents
  > expect the canvas content tray to open, set to Files/Documents
  - click on a document
  > expect the tray to close
  > expect a link to the file in the rce, filename as the visible text,
    class="instructure_file_link",
    if it's a previewable type, class includes instructure_scribd_file and
    the link has target="_blank" rel="noopener noreferrer"
  - put the cursor in the link
  > expect the Options button to appear and the Links toobar button to highlight
  - click on either Options or Links > Edit
  > expect the Link Options tray to open
  > if the file is a previewable type, expect to see the Display Options checkboxes
    if not, all you see is Text and Link textboxes
  - change the Text and click Done
  > expect to see the new text
  - edit the link again
  - check the Disable inline preview checkbox
  > expect the Automatically open... checkbox to be hidden
  - click Done
  > expect the resulting link class name to include "disable_preview"
  - edit the link again
  - uncheck the Disable checkbox
  > expect the Automatically open.. checkbox to appear
  - check it and click Done
  > expect the resulting link class name to include "auto_open" and not
    "disable_preview"
  - back in the tray, when you check/uncheck the disable checkbox, the
    other checkbox remembers its state

  Uploaded files:
  - from the toolbar select Documents > Upload document
  - upload a previewable document (a pdf works)
  > expect a link to the document to appear in the rce
  - click on the link, then Options
  > Expect the tray to open with the Display Options visible
  > expect this link to behave just like a course document wrt tray
    settings

  The content created a good view
  - save the assignment
  > expect the view mode to have an "external link icon" icon text to the external link
  > for a previewable file expect a "preview icon" next to a link to a previewable course document
  > for a previewable file with "auto open preview", expect the preview
    to have opened
  > for a previewable file with "disable preview", expect there to be no
    preview icon next to the link
  > expect clicking on the external link or course document to open in a new browser
    window|tab (except that some course documents will download. this is
    is an outstanding issue that needs to be dealt with in canvas)
  > expect clicking on a course link to open in the current tab
  > an uploaded file is a course file, so it should behave the same

  * pdf is one. see packages/canvas-rce/src/rce/plugins/shared/Previewable.js for the
    complete list

Change-Id: I5c7295ab02e4e87aab18f1b916b29cb7f18269b1
Reviewed-on: https://gerrit.instructure.com/198234
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2019-06-24 22:38:35 +00:00
Clay Diffrient 7bff4a59b5 Make Unsplash images insert into the RCE
closes CORE-2626

Test Plan:
  - Enable RCE Enhancements
  - Go to a page with an RCE
  - Click images toolbar button, click Upload Image
  - Go to the Unsplash tab
  - Do a search
  - Click an image, then press submit.
  - The image should go into the RCE.

Change-Id: Ic1b1cfe89ab11849754e98483db52e2f4cc50098
Reviewed-on: https://gerrit.instructure.com/198718
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2019-06-24 20:44:50 +00:00
Ed Schiebel a690a93c6d Make RCE StatusBar behave like a toolbar
closes CORE-2903

test plan:
  - load a page with the rce
  - TAB into the RCE and into the StatusBar
  > expect right/left arrows to move focus from one button to
    the next.
  > expect focus to cycle back to the other
    end when you go too far
  - tab out of the status bar
  - click one of the buttons to give it focus
  - use the arrow keys again
  > expect focus to move right|left from the starting point
  - give he drag handle focus
  > expect up/down arrows to resize the RCE w/o scrolling the page
  - fire up a screenreader
  > expect the button area of the status bar to be announced as a
    toolbar

Change-Id: I00e5a761ebc25ae784267c57bb5a653b68ccacba
Reviewed-on: https://gerrit.instructure.com/197059
Tested-by: Jenkins
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-06-17 22:12:57 +00:00
Ed Schiebel 1078a6284d Fix RCEWrapper unit tests
I could not find a way to get the describe("lifecycle") tests to run so
I added a testcafe test that confirms the actions tested in those
specs actually work. Except for replacing the textarea out from under
the RCE, which I just don't see as ever actually happening.

closes CORE-2930

test plan:
  - the tests all pass

Change-Id: I74129dc22249caade8c8569dbe18849c77b1e58b
Reviewed-on: https://gerrit.instructure.com/197262
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-06-14 17:02:06 +00:00
Steven Burnett 01945f8da2 video options tray resizing
fixes CORE-2664 CORE-2663

Test Plan:
- record or drag and drop a video into the video
  plugin modal
- in the video that shows up put your cursor on it
- notice the option pop up
- click options pop up
- change the size of the video
- click done
- notice the video resized

Change-Id: Ib17f58dbb639cd11307360527426a9f3b1eaf22f
Reviewed-on: https://gerrit.instructure.com/197048
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-06-13 18:19:35 +00:00
Ed Schiebel 8289712867 Open RCE links in a new window
There is a bug in tinymce demonstrated in http://fiddle.tinymce.com/YJgaab/1
and reported as an issue at https://github.com/tinymce/tinymce/issues/5036
where the default_link_target is not set on an anchor if the target_list
is not shown in tinymce's link dialog. Because of this, external links
do not open in a new window.

CORE-3065 was created to eventually resolve the issue

closes CORE-2667
refs CORE-3065

test plan:
  - add a course link or course document link to your rce
  - save whatever you were editing
  - click the link
  > expect it to open in a new browser tab (or window,
    depending on your browser settings)
  - add a navigation course link, save, and click the link
  > expect it to load in the current window
  - add an external link, save, and click
  > while it should open in a new tab, it does not due
    to the tinymce bug described above.

Change-Id: I2befef3f41ae85bb33d11d561fd909862942bee3
Reviewed-on: https://gerrit.instructure.com/196958
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2019-06-10 21:51:50 +00:00
Ed Schiebel 399cb5df5a Upload Documents
closes CORE-2973

This implements the Upload Documents modal dialog. In the process,
it moves the Image Upload dialog from plugins/instructure_image to
plugins/shared and updates the image plugin to use it from there.

To do this, the dialog and its child components needed some updating to
generalize the implmemetation to be reused.

test plan:
  - open a page with the rce
  - select Documents -> Upload Documents from the toolbar
  > expect the Upload File modal dialog with only the Computer tab
  - click in the Upload File panel
  > expect the system file picker
  > expect that you can select any type of file
  - pick a file
  > expect:
    > to see the filename, a preview, and a trashcan button
    > if it's a text file the preview is the first few lines
      of the file
    > it it's an image, expect the preview to maintain its
      aspect ratio
    > if it's something else, the preview is a document icon
  - click the trashcan
  > expect the preview to be replaced by the rocket
  - do the file picking thing again, selecting a non-iimage file
  - this time click on Submit
  > expect a link to the file to be inserted in the RCE at the
    text cursor's location.
  > expect the dialog to close
  - start over, then click cancel
  > expect the dialog to close
  - start over, but select an image file and click submit
  > expect the image to be embedded in the rce at the text
    cursor's position
  Sanity check:
  - the Upload Image dialog is now implemented by a common Upload File
    dialog, so let's make sure it still works as expected
  - select Images -> Upload Image from the toolbar
  > expct the Upload Image modal dialog to open with the Computer tab
    and URL tab
  - in the Computer tab, click and the system file picker opens
  > expect that you can only select image files
  - try to drag and drop an image file
  > expect it to work
  - try to drag and drop a non-image file
  > expect an invalid file type error message
  - click submit with a file selected
  > expect the image to be embedded in the rce
  - switch to the URL tab
  - enter the URL to a file (https://placekitten.com/90/50 works)
    and click submit
  > expect a kitten image embedded in the rce

Change-Id: I3c4ec763a8f1e0063facc0f7542bbe94f2579ffa
Reviewed-on: https://gerrit.instructure.com/196089
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-06-07 01:42:38 +00:00
Steven Burnett c11b31c95c allow rce to fetch media player from canvas
fixes CORE-2659 CORE-2661

Test Plan:
- upload a video recording
- notice it shows up in the rce and is fully functional

Change-Id: I852ccccec6582c7f490e5e024b8cbe24ae372f04
Reviewed-on: https://gerrit.instructure.com/196165
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-06-05 23:39:30 +00:00
Ed Schiebel 5ced2e7672 Add documents pane to CanvasContentTray
this also fixes a bug where the store was initialized every time
the tray opened, and queried for folders and files every time too

closes CORE-2974

test plan:
  - have a course with some files, including an image and various text
    documents
  - from /courses/:course_id/assignments/new or similar, click on the
    Documents toolbar button, and Course Dcouments
  > expect the try to open with Files, Documents
  > expect to see your text documents, but not any images, audio or
    video files listed
  - click on a file
  > expect a link to the file to be inserted at the text cursor in the
    editor and the tray to close
  - add some text, and select a word or two
  - open Course Documents again
  - click on a document
  > expect the selected text to be linked to the clicked-on file
  - you can also drag and drop a file, but expect the drag image to
    be funky
  Incremental Loading
  - have more than 50 files, or go into canvas-rce-api/app/api/wrapCanvas.js
    and change DEFAULT_CANVAS_PER_PAGE_ARG = something small
  - click on Documents -> Course Documents
  > expect the first page of documents and a load more button
  - click load more
  > expect the next page of documents, with focus on the last document of the
    previous page
  - disconnect from the network (say, using devtools)
  - click load more
  > expect an error message
  - reconnect to the network and click load more
  > expect the next page of documents

Change-Id: I7118caf4f2a5023473131826b36f31d155cab9a1
Reviewed-on: https://gerrit.instructure.com/194838
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Lauren Williams <lcwilliams@instructure.com>
2019-06-05 17:07:11 +00:00
Steven Burnett bc5b683cd6 allow uploading recorded video to rce
fixes CORE-2659 CORE-2661

Test Plan:
- in the demo site add a jwt and ensure the rcs is running
- spin up and configure notorious to talk to canvas
- click on the upload media button
- notice the modal shows up
- record a video and click save
- notice it saves and embeds a video into the rce

Change-Id: I4845011cb387b1061a97ac755d90537f9b21f44a
Reviewed-on: https://gerrit.instructure.com/194293
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-05-30 13:14:30 +00:00
Ryan Shaw 3cecd3ba7d fix kebab icon in toolbar so it is vertical
Closes: CORE-2984

Test plan:
* go to an editor and make your screen small so it has to put the
  Kebab icon in the toolbar.
* verify that the three dots are vertical and not horizontal

Change-Id: Ia0a9490c242a1e82920ddf9cba8d0b4b73e0e4c7
Reviewed-on: https://gerrit.instructure.com/194997
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-05-28 20:01:42 +00:00
Ed Schiebel dfeb619a33 Defer canvas-rce-api getSession until first data query
closes CORE-3001

test plan:
  - load up the RCE
  > expect no request for /api/session
  - from the toolbar do Images/Course Images
  > expect to see a request for /api/session followed by
    the request for the images
  - without closing the tray, switch from Files to Links
  - expand one of the accordion panes
  > expect to se a request for the data, but not another request
    for the sesson

Change-Id: Ieaa427343fac6dee874f47f68513e6b5cdfa8964
Reviewed-on: https://gerrit.instructure.com/195141
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-05-24 17:57:45 +00:00
Ed Schiebel 946c34b1c6 Update RCE StatusBar
closes CORE-2965 CORE-2966

1. moves html-rich view toggle to the right
2. hides everything but the toggle when in html view
3. adds tooltips to the status bar buttons via a title attribute
   (so they look like the tooltips the toolbar buttons have)
4. removes the language select

test plan:
  - load up an rce and see that ^those changes are reflected in
    what you see

Change-Id: Iac1dd133a779789addca2e8db9af6f192c394b70
Reviewed-on: https://gerrit.instructure.com/194102
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2019-05-17 18:15:58 +00:00
Jon Willesen fe5f4b86cd rce: add path and word count to new status bar
This also replaces our old react-tinymce package with the official
@tinymce/tinymce-react package.

closes CORE-2836

test plan:
- typing in the rce should update the word count in the status bar
- the html path of the current cursor position should also be shown in
  the status bar
- generally test all the rce things because of the package replacement

Change-Id: Ibe2b182ff55ba2dc77988dcd4c1865a28667db95
Reviewed-on: https://gerrit.instructure.com/193154
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
2019-05-17 13:27:35 +00:00
Clay Diffrient 8ac4638ab2 Add placeholders during the process of uploading an image to the RCE
closes CORE-2861

Test Plan:
  - Enable RCE Enhancements in Canvas
  - Go to an RCE instance, wiki pages for example.
  - Use the Upload Image option in the Images toolbar to upload an image
  - Go through the modal confirming the upload, etc.
  - A gray placeholder should show up in the RCE with the same size
    as the image will be.  After a few moments, the placeholder should
    be replaced by the actual image.
  - Submit the form, everything should work fine.
  - Repeat the process, but while the placeholder is still there
    attempt to submit the form.
  - A prompt should appear with a warning.
  - Answering no to the prompt should stop the submission process.
  - After the image is there, the prompt should not appear.
  - If you answer yes to the prompt, then the submission should keep
    going.

Change-Id: I83b33c29c07ae145117c1a377bcfe2ec25b154ab
Reviewed-on: https://gerrit.instructure.com/193858
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-05-16 21:52:40 +00:00
Ed Schiebel b9a70dbc11 skin rce using themeable
closes CORE-2630

test plan:
  - does the rce look like the mockup with the default theme?
  - does the rce look like the current custom canvas theme?
  - does the rce look right in high contrast?
  - do all the toolbar buttons work?
  - does kb nav among the toolbar buttons work?
     1. tab between toolbar button groups
     2. arrow between buttons in a group

you may ask "Why am I testing that buttons work?" Because simple changes
like adding a background to a button breaks kb nav.

Change-Id: Ie36335b36ac3a27a0d49314310fe7e338bef411f
Reviewed-on: https://gerrit.instructure.com/192410
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Laura Leavitt <lleavitt@instructure.com>
2019-05-13 17:24:48 +00:00
Clay Diffrient ff3b6fbf0c UploadImage Computer Tab
closes CORE-2623
closes CORE-2624

Test Plan:
  - Enable RCE enhancements
  - Go to an RCE instance
  - Click the images toolbar button and select 'Upload Image'
  - The computer tab should be the default option there
  - You should be able to drag and drop a picture to the drag/drop area
  - Click submit should close the modal and after what will likely be an
    long time (addressed in a future ticket) an image should appear in the
    RCE
  - Do the same by uploading an image using the file dialog (clicking the drag
    and drop area)

Change-Id: I72ccb5afaf5a8d7edaf1598414457d87e5efed1c
Reviewed-on: https://gerrit.instructure.com/189588
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-05-06 19:39:34 +00:00
Jon Willesen 8fd7f030d5 rce: add custom status bar
This is just the visual appearance and the starter component. Nothing
works yet.

closes CORE-2835

test plan:
- The default rce status bar should be replaced with the new status bar.

Change-Id: Id6685ee4be7505105a4a6d9cd0d1726ac87b111b
Reviewed-on: https://gerrit.instructure.com/191521
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-05-03 19:13:09 +00:00
Ed Schiebel dd1dc4334b make course links a plugin in CanvasContentTray
closes CORE-2618

test plan:
  - confirm the links button is a menu button with external and course
    links items
  - click on course links
  > confirm the CanvasContentTray opens with links selected in the
    filter and the links panel displayed
  - expand one of the sections
  > expect the section to be filled with links to the learning objects
  - click on a link
  > expect a link to be added to the active RCE
  > if you select text in the RCE, then click on a link, expect the
    selected text to be linked
  - if you have the canvas-rce-api running, this should all work
    from within canvas too (say an assignment edit page)

with the canvas-rce-api running, this should work in the demo
with the fake source or real. To get the
real source working, first open a page in canvas and copy ENV.JWT and
paste that into the config options and click update. (Note: the demo
only works if you refresh the page after switching between real and
fake data sources)

Change-Id: Iab5962a602062921ca264deebe4af7e4c4f912e9
Reviewed-on: https://gerrit.instructure.com/189394
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
2019-04-26 16:41:45 +00:00
Clay Diffrient 0167af7a29 Image Plugin: UploadImage
This adds the launch mechanism to open the Upload Image modal
from the toolbar menu item.

closes CORE-2622
closes CORE-2625

Test Plan:
  - Start RCE dev environment
  - Click Image Icon in toolbar of one of the RCE instances
  - Click 'Upload Image' option
  - Modal should appear, it should have 3 tabs:
    'Computer', 'Unsplash', and 'URL'

Change-Id: I781d21aa32a11e68a55a09f4e2e33e63b8539ee6
Reviewed-on: https://gerrit.instructure.com/189113
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
2019-04-17 14:20:04 +00:00
Ryan Shaw cf4e4baa23 Fix css loading for tinymce 5
this fixes the canvas-rce build and means our consumers don't have to
neccisarily be using webpack

test plan:
* cd packages/canvas-rce
* `yarn && yarn test` should work

Change-Id: I25b2262193b45e38c49fb9afea181e900f269fc7
Reviewed-on: https://gerrit.instructure.com/188628
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-04-08 17:17:27 +00:00
Ryan Shaw 9ddd8269b2 upgrade tinymce to 5.x
Closes: CORE-2599

Test plan:
* with the rce_enhancements feature flag turned off, nothing should 
  change
* turn on the rce_enhancements feature flag
* go to an editor
* it should load without throwing any errors
  - note, you will see some “bomb” icons that we will need to update
    And the formatting/styling of the toolbar will need some work.
    But that is ok for this commit because it is all behind the feature
    Flag and we will get address those in a future commit

Change-Id: If28167731b5b285005143861e19fdb2fc0c34def
Reviewed-on: https://gerrit.instructure.com/187179
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2019-04-05 19:17:03 +00:00
Jon Willesen 32a74f2278 upgrade instUI to 5.38.0
refs ADMIN-2277

test plan:
- Do some spot checking all around, esp. on newer stuff written with
  InstUI
- Do some specific spot checking on:
  - Assignments edit page. Esp. with moderated grading
  - Gradebook late policies
- Check the original bug (ADMIN-2211)

Change-Id: Iaaaeb9d86dc2d59cb2c9ccca2a8764a5adb0896b
Reviewed-on: https://gerrit.instructure.com/176912
Tested-by: Jenkins
Reviewed-by: Anju Reddy <areddy@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2019-01-07 21:24:50 +00:00
Neil Gupta dfa6e442fd automatically add an aria-label to RCE body if textarea had a label
fixes OUT-2848

Test plan:
* Visit the course or account outcomes page
* Click add a new outcome
* Turn on VoiceOver
* Navigate to rich text area
* VoiceOver should now read the label "Describe this outcome"

This fix should fix the label issue for all instances of RCE in Canvas

Change-Id: I476a50a4fae1d22c04ccbac0ffd142a594c8427c
Reviewed-on: https://gerrit.instructure.com/173366
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>
2018-11-28 01:00:44 +00:00
Clay Diffrient a094bbde42 Disable RCE files tab in courses with files disabled
closes CORE-1644

Test Plan:
  - Go to a course and disable the files section
  - As a student, go to a page with an RCS sidebar
  - You should not see a files tab

Change-Id: I3291cc90a363404a33e5b07077bcea3a031f9dcc
Reviewed-on: https://gerrit.instructure.com/159626
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2018-10-05 22:43:12 +00:00
Ryan Shaw 36faabec33 get canvas-rce test to work w/ react 16
Change-Id: I7fb89996c4ff2d8e6058a6497a2f324315b54d83
Reviewed-on: https://gerrit.instructure.com/164136
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-09-12 15:57:59 +00:00
Clay Diffrient b1f9fe1925 Add loading message for upload folder selection
This should help users on slower connections anticipate more
folders loading.

closes CORE-10

Test Plan:
  - Using a course with RCS enabled
  - Add 60+ subfolders to a root folder.  For example
    Course Files > Main Folder > { 60+ folders here }
  - Go to a page or anywhere else with the RCS
  - Click the files tab then the upload file link
  - The Folder select box should show "Loading folders..." until it
    has loaded all of them.
  - Selections should be available as soon as they load while still
    showing that message at the top.

Change-Id: Id2d8740f82f331b3a3499db86e8ad19249fa4825
Reviewed-on: https://gerrit.instructure.com/159051
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-08-13 19:16:48 +00:00
Clay Diffrient d07f1b7ea2 Fix links failing to insert in RCE
closes CORE-1695

Test Plan:
  - Go to a page with a RCE/RCS
  - Click a link from the links tab
  - It inserts into the RCE
  - Please regression test all the sidebar interactions :(

Change-Id: Ia81c6e770272c260d6d827b675c28da8f196bdb9
Reviewed-on: https://gerrit.instructure.com/160040
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-08-09 17:28:50 +00:00
Clay Diffrient 89e87ab8b6 Fixes adding images from the sidebar
closes CORE-1683

Test Plan:
  - Go to a location with a sidebar
  - Insert an image using the sidebar images tab
  - It should work

Change-Id: I05f1b4bff7831288f0a3f57137874337f274db72
Reviewed-on: https://gerrit.instructure.com/159405
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-08-04 13:10:13 +00:00
Brent Burgoyne 666a09b6de fix rce image insertion when editing html
fixes CORE-1625

test plan:
- edit a wiki page
- switch to html editor
- upload multiple images from the sidebar
- multiple uploads should work

Change-Id: Iad9759ce73b7c2fd1ccd136269d4bd3fc2c99a60
Reviewed-on: https://gerrit.instructure.com/157401
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-07-19 19:37:14 +00:00
Clay Diffrient b58d8029c3 Handle inserting links to existing text in IE 11
closes CORE-1362

Test Plan:
  - In IE 11 with RCE/RCS enabled go to a page
  - Enter in some content to the page
  - Select some content and click the link toolbar button
  - The link should appear on those words.
  - Click that link and have the cursor somewhere within that
    link.
  - Click the link toolbar button again
  - Replace the existing url with a new one
  - The link should update and look the same as it did before.
  - Repeat test in another browser for completeness.

Change-Id: I62079c00526f65fa7ded58a2e6abd5986385759f
Reviewed-on: https://gerrit.instructure.com/157347
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-07-18 21:31:55 +00:00
Ryan Shaw e2ea2e93e3 fix canvas-rce <Select> bugs
Closes: CORE-1606 CORE-1607

This commit goes back to using a <Select> w/ native <option>s. The
new <Select> in ui-forms still has a bunch of edge-cases it needs
to work out.

Test plan:
* run through the test plan on the 2 linked jira tickets and make sure
  They work
* also run through the test plan from g/155334 and make sure those
  all still work.

Change-Id: I292e1d1f7ea5f177eb02526f286b90f8233487f1
Reviewed-on: https://gerrit.instructure.com/156474
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-07-17 23:16:48 +00:00
Ryan Shaw 3837411f7d canvas-rce: upgrade package.json devDependencies
closes:  CORE-1618

test plan:
* smoke test canvas-rce to make sure clicking around still works

Change-Id: I03f427a471aae45d07bdec916aeb15d75666de78
Reviewed-on: https://gerrit.instructure.com/156318
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-07-06 17:11:03 +00:00
Ryan Shaw 4b510e448f canvas-rce: upgrade prod deps
closes:  CORE-1617

test plan:
* smoke test canvas-rce to make sure clicking around still works

Change-Id: Ic89aaf8f130f1910b7f35c2bc64f3cdbca8defbd
Reviewed-on: https://gerrit.instructure.com/156309
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-07-06 17:10:01 +00:00
Brent Burgoyne 2dbffa9c2e fix inst-ui upgrade select bugs in rce sidebar
closes CORE-1571, closes CORE-1572, closes CORE-1573

test plan:
- make sure course has a sub-folder in files
- enable usage rights feature flag (account or course)
- edit a wiki page
- in the files tab click "upload a file"
- select a file
- select the sub folder
- select creative commons license
- pick a specific cc license type
- upload
- check in course files
  - file should be in selected sub folder
  - file should be published
  - file should have correct usage rights

Change-Id: I685440492eec17f2ae923f6858e980899bc8b287
Reviewed-on: https://gerrit.instructure.com/155334
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-06-27 00:39:48 +00:00
Jeremy Neander 1479a5c937 spec: increase the timeout of canvas-rce specs
Also:
 * update mocha-jsdom to eliminate a spec issue
 * fix some specs

test plan:
 * Verify Jenkins passes

Change-Id: Ib486336306719b5ca4160e15843a0aac084c5c92
Reviewed-on: https://gerrit.instructure.com/153972
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-06-15 17:11:19 +00:00
Ryan Shaw 53467da087 canvas-rce: fix “unhandled promise rejection” in tests
Test plan:
* run yarn test or look at the console output of linters and js build
* you should not see any:
| (node:6453) UnhandledPromiseRejectionWarning: Error: only absolute
urls are supported
 at node_modules/node-fetch/index.js:54:10
 at new Promise (<anonymous>)
 at new Fetch packages/canvas-rce/(/node-fetch/index.js:49:9)
 at Fetch packages/canvas-rce/(node-fetch/index.js:37:10)
 at module.exports (isomorphic-fetch/fetch-npm-node.js:8:19)
 at RceApiSource.apiFetch (canvas-rce/src/sidebar/sources/api.js:236:12)
 …

* the cavas-rce tests should pass

Change-Id: Id2ab92752f316dacc34290994645e47018fd0742
Reviewed-on: https://gerrit.instructure.com/153120
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-06-08 19:18:32 +00:00
Ryan Shaw e415eaa961 Use yarn workspaces
Run `script/nuke_node.sh` to clean everything up
Run `yarn install` it should install everything for everything
Run `yarn build` and `yarn test` they should work exactly as before

Change-Id: I11a27ff2d705c6cbb3b3f9029dd8b32138706146
Reviewed-on: https://gerrit.instructure.com/151356
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-06-04 20:02:02 +00:00
Ryan Shaw 03cb9f3b9a canvas-rce: update deps & prepare for workspaces
Test plan:
* tests should pass
* everything should work exactly as before

Change-Id: Iad2144ec0ab41087ea5efcc89f3492bf791dd7cf
Reviewed-on: https://gerrit.instructure.com/152122
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-06-01 16:45:44 +00:00
Clay Diffrient 5f9d1c3876 Generate immediate thumbnails in the browser
This makes it so we never have a situtation right after upload
where we are waiting for a thumbnail image to be generated in a
background process.

closes CORE-1360

Test Plan:
  - Upload an image file  using the sidebar images tab.
  - You should see a thumbnail for it when it loads in the
    list of other images in the sidebar.

Change-Id: I5235d72469c0078174d9caa662a537cecb2b17b3
Reviewed-on: https://gerrit.instructure.com/148912
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-05-21 21:36:19 +00:00
Ryan Shaw 0b4df04034 canvas-rce: replace Accordion w/ ToggleDetails
closes: CORE-1411

The ‘accordion’ variant of TabList is deprecated and we should use
The <ToggleDetails> component instead. This is needed before we can
upgrade to instUI 5

Test plan:
* go to the demo page
* on the “links” tab, the accordion with the “Pages”, “Assignments”,
  etc, has been replaced with a new InstUI component
* it should work the same as before

Change-Id: I9344525287cb30c7b01200b8d4dba0ba084c9305
Reviewed-on: https://gerrit.instructure.com/149946
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-05-21 18:30:55 +00:00
Clay Diffrient 0a9226051e Add quota error handling to RCS sidebar
closes CORE-1239

Test Plan:
  - Set a course's usage quota to 10mb (or anything low)
  - Attempt to upload a file bigger than that through
    the RCS sidebar
  - Notice an error shows up
  - Upload a file less than the quota
  - Notice the error goes away

Change-Id: I2b8cab2fb76d3ec3520fff5eee337892d34d56d1
Reviewed-on: https://gerrit.instructure.com/150085
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Rohan Cheeniyil <rcheeniyil@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-05-17 19:08:47 +00:00
Jeremy Neander 2a4996c9ee Revert "fix i18n for react CanvasRce"
This reverts commit d90f7b14ce.

Change-Id: Iba6c43bf8ade76528d805a7d5a371c4ce053998c
Reviewed-on: https://gerrit.instructure.com/150478
Tested-by: Jenkins
Reviewed-by: Jared Crystal <jcrystal@instructure.com>
Product-Review: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
2018-05-16 21:23:30 +00:00
Jared Crystal d90f7b14ce fix i18n for react CanvasRce
refs QUIZ-4451

test plan:
 - comment out the non-react examples for the demo
   (if you don't comment them out, they will pull in the locale files)
 - change the language for the demo
 - the rce should reflect the change

Change-Id: I516f917fc466dc2d081c4e18fb34b909940711cc
Reviewed-on: https://gerrit.instructure.com/149760
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-05-16 17:47:23 +00:00
Jacob Fugal 3a4e3daf1c default display_name if not returned in getFile
refs RECNVS-436

test-plan:
- have a canvas using both rce sidebar and inst-fs
- upload a file to inst-fs through the sidebar in canvas
- file should upload, and file entry added to tree should have a name

Change-Id: Ib31da106e691e2af2748ff5e4e6127d34bbb4979
Reviewed-on: https://gerrit.instructure.com/149603
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2018-05-08 21:54:48 +00:00
Steven Burnett 6c4ce74db4 fix sidebar names to match real navigation
Test Plan:
- Ensure the wiki side bar looks like the
  text found in the below link
https://community.canvaslms.com/ideas/7870-change-link-names-to-reflect-tool-names

Change-Id: If962fdfd89e03aceeb4cb24e1a21c536805c75cf
Reviewed-on: https://gerrit.instructure.com/148402
Product-Review: Christi Wruck
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Burnett <sburnett@instructure.com>
2018-05-04 13:19:51 +00:00
Brent Burgoyne f91658d4bf move canvas-rce to canvas-lms/packages/canvas-rce
closes CORE-994
refs RECNVS-398
refs CORE-1224
closes CORE-1237

test plan:
- yarn install
- smoke test rce
- tests pass

Change-Id: Ieaff024fa89879fac3e7edf99381f46de921cce2
Reviewed-on: https://gerrit.instructure.com/145671
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2018-05-01 13:46:18 +00:00