Commit Graph

146 Commits

Author SHA1 Message Date
Ed Schiebel f79fc795b9 Add support for webp images
[skip-crystalball]

closes LS-1734
flag=none

test plan:
  - upload a webp image from the Files page
  > expect it to work like all other images
  > expect to be able to preview it
  - upload a webp image from the RCE's image upload dialog
  > expect it to get embedded in the RCE
  - open the course images tray
  > expect it to be there, with a thumbnail
  > expect to be able to adjust its size using the image options tray

Change-Id: I621a3f5fc455bc3aaf19928a5cfa7931a1694277
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286027
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2022-03-08 23:56:11 +00:00
Weston Dransfield 179cb8cf0b Don't add context to data-download-url links
refs MAT-719
flag=buttons_and_icons_root_account

Test Plan:
- build canvas-rce and Canvas JS bundles
- Create two assignments in a course:
  Assignment A and Assignment B
- In assignment A, create a new button and
  icon in the assignment description. Save the
  assignment.
- In assignment B, embed the same icon into
  the description using the existing buttons
  and icons tray. Save assignment B.
- Edit assignment A. Select the button and icon
  then choose "Edit". Modify the button and icon,
  check the box to save to all instances of the button,
  then apply the changes.
- Save Assignment A
- Navigate to assignment B and verify the changes
  made to the button in Assignment A have been
  made to the button in assignment B
- Attempt to edit the button and icon in assignment B.
- Validate the edit tray is pre-populated
- Copy the course from the course settings page (make sure
  you have delayed jobs running)
- In the new course, navigate to the edit  page of
  assignment A.
- Change the RCE view to HTML
- Validate the data-download-url on the button and
  icon image tag does not contain "/courses/:course_id".
  It should just be /files/:file_id...
- Validate the data-download-url on the button and
  icon image contains a "buttons_and_icons=1" query
  parameter
- Switch back to the WYSIWYG view of the RCE
- Select the button and icon and choose "edit"
- Validate the edit tray is pre-populated with the
  correct details. Verify you can make changes to
  the button and icon.
- Save assignment A and navigate to Assignment B
  in the new course
- Edit the button and icon in Assignment B. Make some
  changes and check the "save to all instances..." checkbox
  before clicking apply.
- Save assignment B
- Navigate to assignment A in the new course and verify
  the changes made to the button and icon in assignment B
  have been reflected
- Do a course copy of the copy
- Do quick validation to make sure buttons and icons can
  still be edited, even after going through multiple course
  copies

Change-Id: I8c3f3a25f1ce3a1129eb11c29b9abc1a363ff3b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286408
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Joe Hernandez <joe.hernandez@instructure.com>
QA-Review: Joe Hernandez <joe.hernandez@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2022-03-07 22:27:36 +00:00
Weston Dransfield 5b206f3b82 Use data-download-url for editing B&I
closes MAT-700
flag=buttons_and_icons_root_account

Test Plan:
- Build canvas-rce and Canavs JS bundles
- Naviate to and RCE and open the Buttons &
  Icons tray
- Create a button and icon and embed it in
  the RCE
- Switch to the HTML view of the RCE and validate
  the image has a data-download-url attribute
  with a value that looks like this:
  "http://canvas.docker/files/1578/
    download?download_frd=1"
  Especially note that the attribute value does not
  contain "courses/:id".
- Switch back to the WYSIWYG view of RCE
- Open the saved buttons & icons tray and insert
  a previously created button & icon
- Validate that the button and icon inserted this
  way also has the data-download-url attribute
  with a similar URL
- Save the content on the assignment/page/whatever
- Edit the assignment/page/whatever
- Switch to the HTML view of the RCE
- Note that both images "src" attributes have now
  changed to include the course context
- Validate the "data-download-url" values have not
  changed (meaning they don't have "courses/:id"
  in them like the "src" attribute now does)
- Switch back to the WYSIWYG view of the RCE
- Open the browser's network inspector and/or
  clear the network history in the inspector
- Select one of the buttons and icons and click "edit"
- Verify GET request is made to the URL found in the
  "data-download-url" attribute
- Verify the edit tray opens and is pre-populated with
  the SVGs data
- Verify you can make changes and save them

Change-Id: Ia509999cdc2ad9ffe53f803a84850e1d68a80275
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285540
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
QA-Review: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
2022-02-23 14:29:22 +00:00
Weston Dransfield 24282ccb00 Detect B&Is during RCE uploads
closes MAT-364
flag=rce_buttons_and_icons

Test Plan
- Re-build canvas-rce and canvas webpack
- Verify you have the latest canvas-rce-api
  checked out and running
- Create a button and icon. Navigate to
  course files and download it
- Delete that button and icon from course files
- In the RCE, choose use the toolbar to upload
  an image. Choose the button & icon previously
  downloaded
- Verify the image uploads and is inserted into RCE
- Open the "saved buttons & icons" tray
- Verify the image you just uploaded is now listed
  as a button and icon

Change-Id: I379e53c05976511729faaf07b6a70c1dc2c4985e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284188
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2022-02-03 22:15:35 +00:00
Weston Dransfield 450521daee Don't show B&I in course image tray
Closes MAT-650
flag=rce_buttons_and_icons

Test Plan:
- Build canvas-rce and Canvas webpack
- Navigate to an RCE and create a button and
  icon
- Open "Course Images" in the toolbar and verify
  no buttons and icons are present, just regular
  cousre images

Change-Id: I2644219c3ee6c7040eea7f3d2c2db183552a7c60
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284277
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2022-02-03 20:27:03 +00:00
Weston Dransfield 7f20fd23e2 Filter by category when viewing saved B&I
Closes MAT-633
flag=buttons_and_icons

Test Plan
- Enable buttons & icons in your site admin
  account if needed
- Build packages/canvas-rce and re-bundle Canvas
  JS with webpack
- In a course, create more than 50 buttons & icons.
  this can be done programatically. Chat with Weston
  if you would like directions.
- In that course, open the "Saved Buttons & Icons" tray
  by clicking the small arrow next to the buttons and
  icons tool.
- Verify buttons and icons are loaded (50) with an option
  to load more at the bottom of the tray.
- Click "Load More" and verify the rest of the buttons and
  icons are rendered.
- Click one of the buttons and icons and verify it is embedded
  into the RCE
- Focus the embedded button and icon in the RCE. Verify an "Edit"
  option appears in the floating toolbar. Verify you can edit the
  button and icon
- Navigate to the files UI for the course and navigate to the
  Buttons and Icons folder
- Select the menu button on one of the svg files (the vertical "...")
- Choose "Move" and move the button and icon svg to a new folder
  in the course (not nested in the "Buttons and Icons" folder)
- Navigate to an RCE in the course and open the "Saved Buttons & Icons"
  tray again.
- Verify the button that is no longer in the primary "Buttons and Icons"
  folder still shows up and is embedable.

Change-Id: I583f32d59330b8e3bf067ab606eac348882173ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283795
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
2022-02-01 21:38:19 +00:00
Weston Dransfield 9c49a0ef07 Send "category" in course image request for B&I
refs MAT-633
flag=buttons_and_icons

Test Plan
- Check out the associated RCS commit at g/283765
- Restart RCS if it's already running
- Rebuild canvas-rce + canvas webpack bundles
- In a course, create a button and icon
- In the same course, upload some images via the
  "files" UI
- Open the buttons & icons tray and navigate to the
  "Image" section
- Choose "Course Images"
> Verify the button and icon created ins tep 4 does
  not appear on the list. Note you may see older buttons
  and icons that were created previous to recent changes
> Verify the image uploaded in step 5 is listed
> Verify you can still list and insert course images
  as expected via the images tool in the RCE toolbar

Change-Id: I3120712734f115985dfbb90d715d50939c693521
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283766
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
2022-02-01 19:40:24 +00:00
Weston Dransfield 2af540b641 Set category when creating button & icon files
closes MAT-631
flag=rce_buttons_and_icons

Test Plan:
- Create a button and icon and observe the network
  requests being made for the file upload
- Verify a category: "buttons_and_icons" param
  is sent in the post request to the
  "http://rce.canvas.docker/api/upload" endpoint

Change-Id: I21ee4d7af00f6b8642c44c4388497df62759674b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283594
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Joe Hernandez <joe.hernandez@instructure.com>
QA-Review: Joe Hernandez <joe.hernandez@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2022-01-26 22:03:19 +00:00
Jon Scheiding 4b7c3a4e00 Fix mocha tests
flag=none

Some tests were being skipped by the process.exit
in the RCEWrapper tests

Broken tests:
- sanitizePlugins FKA sanitizeEditorOptions
  behavior changed when old RCE was removed
- normalizeProps
  behavior changed when old RCE was removed
- RCE api tests
  apparent behavior change with introduction of a search term option
- sidebar
  mostly these tests were just wrong, one needed a mock
- equation insertion refactor
  problems with async usage

test plan:
- jenkins passes

Change-Id: I68b08e468d21bdf8205e2089848ed7bc5e7e751d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281981
Reviewed-by: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-01-03 23:06:03 +00:00
Jon Scheiding 97e7cdd219 Move RCS interface out of sidebar
Just a refactor to make the structure more sensible

flag=none
test plan
- jenkins passes

Change-Id: I23fba5b0383350f789085bc7a385539146b16dc3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281968
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gonzalo Penaranda <gonzalo.penaranda@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2022-01-03 19:54:52 +00:00
Jon Scheiding 6d83b744b7 Use absolute URLs for equation images
- Refactor new math editor to use existing insertMathEquation method
- Copy mathml lib into RCE to support new math editor 😔

flag=none
Fixes MAT-471

test plan
Note: depends on RCS changes in
https://gerrit.instructure.com/c/canvas-rce-api/+/281790

- make sure you're using an RCS that includes the above changes
- find an RCE
- insert an equation
- switch to HTML view and verify that the equation image uses an
  absolute URL

Change-Id: I132c3447060941f8a00d526d9d55543080952c51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281797
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2021-12-22 20:34:40 +00:00
Weston Dransfield f4c0c8f4d0 Remove cc_in_rce_video_tray flag
Closes MAT-137
flag=none

Test Plan:
- Navigate to the site admin account on your
  local Canvas and verify the flag is gone
- Navigate to an RCE and upload a video
- Click the video and then click "Video Options"
- Verify you can upload closed captions from the
  tray that opens

Change-Id: I4457585873a341d1b3944729a2407f9340a18328
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280803
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-12-21 21:16:02 +00:00
Ed Schiebel 2a277632c2 Make typeset math and math image match
at least get them much closer.
1. typeset math using svg by default, which is how the image is generated
2. size the image so it matches the surrounding font-size

Also, still typeset math from images even if the image fails to load.

closes MAT-501
flag=new_math_equation_handling

SIZING MATH REQUIRES A COMPANION CHANGE TO MATHMAN (the other stuff doesn't)
  - clone git clone ssh://<yourid>@gerrit.instructure.com:29418/mathman
    and follow the instructions for building.
  - checkout https://gerrit.instructure.com/c/mathman/+/277389
  - build it (once built, you don't have to run in in docker)
  - in a canvas rails console:
    Setting.set(
      'equation_image_url,
      'http://localhost:8000/svg?tex='
    )
    http://localhost:8000 is where mathman is via `node app.js`
    it's at http://mathman.docker if in docker (at least that's
    what the README says, I don't really know)
  - test mathman by requesting `http://<mathman-url>/svg?tex=17`
    and expect an image of "17". now try with `request /svg?tex=17&scale=2`
    and your "17" shoul be twice as large.
  - restart your canvas server

test plan:
  Updated typesetting:
  - have a question_bank quetsion with math and answers with math
  - include the question in a quiz
  > verify that the question looks the same in the question bank
    as it does when previewing/taking the quiz
    - if your math includes a "g", it should look the same
    - the size of the equation should be pretty close
  Sizing to match:
  - turn on scale_math_equations site admin feature
  - put an equation w/in a paragraph with a large font, or
    add an equation to the rce, select it, and change the font size
  - click on the equation, edit equation, click insert equation
    w/o changing anything
  > expect the equation to match the larger font.

  - extra credit: DO THIS WITH AND WITHOUT MATHMAN PLUGIN ENABLED
    (yes, there are 2 paths canvas takes to mathman)
    make sure to update dyanmic-settings.yml's math-man entry
    math-man:
      base_url: 'http://localhost:8000'
      use_for_svg: 'true'
      use_for_mml: 'false'
  - at /plugins, enable mathman plugin and ensure use_for_svg istrue

  Error handling:
  - change the URL to mathman to a dead end
  - load a page with math equation images
  > expect the math to be typeset by mathjax

Change-Id: I354e98a0a0256740ce5b4937f5b4e3adc690fe51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277245
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-11-09 19:28:42 +00:00
Ed Schiebel 5c6cae1d3f Update some rce unit tests
closes MAT-507
flag=none

test plan: passes jenkins

Change-Id: Ibd76101c4a7a75c5656a70a03b46afa25e86fdcc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277430
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Jon Scheiding <jon.scheiding@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2021-11-04 15:38:06 +00:00
Gary Mei a74f6aaf7d avoid doubling results in rce image content tray
If you type at a specific cadence, you could trigger two api requests
for images and the second one would be for the stale search term, but
the images would still come be inserted into the content tray. This
ignores the stale queries when they resolve.

fixes MAT-400
flag=none

Test Plan
- Upload two files with at least the first six letters of their
  filenames the same.
- Type in the search bar the first three letters, then at a slight
  pause, type the other characters such that they would match both
  files again.
- Do the above over and over again, verifying that the tray never
  has duplicate results.

Change-Id: Ib41c1c16ec1f48aa118ddc4b0f4d658723c08d1e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274943
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
2021-10-19 19:23:18 +00:00
Ed Schiebel e9afcfcce3 Remove rce_enhancements flag from canvas - phase 1
refs LS-2655
flag=none

- this updates the files under ./ui, a few ancillary files and specs.
- Sadly the commit hook ran prettier and
  fiddled with the formatting of a handful of files too.
- Also made a few changes to quiet lint errors
- Also updated OutcomeManagement.test.js. I don't understand why,
  but 'renders ManagementHeader with lhsGroupId if selected a group in lhs'
  started failing with this change, even though nothing obviously related
  changed. The problem is that the modal isn't getting attached to the
  document being tested. The spec changed to test that the modal contained
  what it's supposed to contain.

test plan: jenkins passes and the RCE works

Change-Id: I48d85077bdbf7563cb07510d3e71d2b448c55e49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275301
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-10-08 16:59:19 +00:00
Weston Dransfield 7c04ed4a19 Remove accidental "it.only"
flag=none

Test Plan:
all tests in api.test.js pass in canvas-rce

Change-Id: I8b6e668209c4da6df56ed08fb743cf67b5175335
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274930
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2021-09-30 22:27:43 +00:00
Weston Dransfield 0c2bf38317 Dedup "onDuplicate" params in Button & Icons
refs MAT-182
flag=rce_buttons_and_icons

Test Plan:
- Edit and button & icon
> Verify the "upload" request made to RCS
  only includes one instance of "onDuplicate"
  parameter

Change-Id: I961514a79eb947e26387ff7ddc8e0fd948f01285
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273579
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jon Scheiding <jon.scheiding@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2021-09-17 19:43:42 +00:00
Weston Dransfield 3d4f1b1bd0 Enable save & replace functionality for B&I
Closes MAT-182
flag=rce_buttons_and_icons

Test Plan
- Create a page and embed a button/icon
- Create a second page with the same button/icon.
  Be sure to use the "saved button and icons"
  tool bar item and select the same image from the
  first step
- On the second page, edit the button/icon
- Make noticable changes and choose the option
  to "save and replace"
- Save the second page
> Navigate to the first page and verify the changes
  to the button/icon on the second page are present
  on the first page
- Edit the button/icon on the fist page. Make noticable
  changes and choose the option to "save as a copy"
> Navigate to the second page and verify the changes
  from the previous step are only applied to the first
  page

Change-Id: I253a683b9afd8f952d68a0deaf974e0241b5deb3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273434
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Juan Chavez <juan.chavez@instructure.com>
QA-Review: Juan Chavez <juan.chavez@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2021-09-14 20:41:41 +00:00
Gary Mei a13867e00f show saved buttons and icons in rce tray
closes MAT-185
flag=rce_buttons_and_icons

Test Plan
- Create many (ideally 25+) Buttons and Icons.
- Open the Saved Buttons and Icons tray.
- Verify that the Buttons and Icons appear.
- Verify that pagination works (paginates at 25).
- Verify that filtering by a search string works.
- Verify that sorting by date works.
- Verify that sorting alphabetically works.
- Verify that switching to another Tray type and back works.

Change-Id: Ie4fec38cca8cb827c23b4ce044beb67809df7216
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271811
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
2021-08-24 15:28:44 +00:00
Weston Dransfield 67ee604df9 Unmount mentions when editor is closed
Fixes MAT-392
flag=rce_mentions_in_discussions

Test Plan:
- In a discussion, initiate a mention
- Click "cancel"
> Verify the mentions component is unmounted
- Repeat for the "cancel" and "html editor"
  buttons
> Verify you can still inject mentions HTML
  with a click or enter key

Change-Id: I191c07436e6f7a0f112f2b95bdb4ba724fd42789
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271624
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeffrey Johnson <jeffrey.johnson@instructure.com>
QA-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
Product-Review: Jeffrey Johnson <jeffrey.johnson@instructure.com>
2021-08-17 22:01:06 +00:00
Weston Dransfield 04f477b965 Proxy RCE file exporer file request through RCS
Refs MAT-297
flag=none

Depends on g/270110 deployment

Test Plan:
1. Check out the commit in RCS mentioned above and
   start the RCS service
2. In Canvas, navigate to an RCE in a coures context
   (example: on the new assignments page)
3. Open the file explorer by clicking "course documents"
   and then choosing "Files" and "All" in the selectors
4. Verify you can expand the "Course files" directory
   and see files within. Also verify you can see files
   that are nested a few levels deep.
5. Verify the same for the "My  files" directory
6. Verify you can insert embedable media: videos, audio,
   and images. Inserting these types should show the
   actual embedded file in RCE, not a link to the file.
   (requires notorious running)
7. Verify you can embed other file types (pdf, etc.)
   These types should create links to the files in
   Canvas.
8. Verify steps 3-7 again, but this time in the
   context of a group (http://canvas.docker/groups/6)
   Instead of checking the "Course files" dir, check
   functionality of "Group files"

Change-Id: I38460cace4767527ef07a05d51daeb38b46833b1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270111
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-08-05 19:19:06 +00:00
Ed Schiebel 9930acbbfb Harvard RCE tweaks
- not directly related to the RCE, but now preload the
3 lato-exended font variants likely to be used
  on the page. this keeps font loading from blocking
- the big change is to make it possible to limit the number
  of RCEs that will fully render on page load. This should
  address the loading issues for quizzes with many essay questions
  (the sample quiz from Harvard had 30 + other questions)
  For now, the necessary property is only being set on the
  take-quiz page

closes: MAT-355
flag=rce_enhancements,flag=rce_limit_init_render_on_page

test plan:
    account flag.
  - create a legacy quiz with > 5 essay questions. Feel
    free to have other questions in there too if you like
  - preview or take the quiz
  > expect all 6 RCEs to be created on the page
    - you could use React dev tools or
      document.querySelectorAll('.rce-wrapper').length === 6
  - turn the "RCE Limit number of RCEs initially rendered on th page"
    account feature flag on
  - take the quiz again
  > expect only the first 5 RCEs to be fully rendered
  - scroll down to the bring the 6th into view
  > expect it to be fully realized
  - while scrolled to the bottom, refresh the page
  > not that the 6th RCE is in view, expect it to be
    fully realized also

Change-Id: Idd76a56c4ea69e45a4f1cc28e3cd8561b40c2403
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270075
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-08-05 14:02:03 +00:00
Gary Mei 22981e1f49 save rce buttons and icons to course folder
closes MAT-178
flag=rce_buttons_and_icons

Test Plan
- Open the Buttons and Icons tray from the RCE in a course.
- Create a distinct button.
- Click Apply.
- Verify that a folder named "Buttons and Icons" is created.
- Verify that the button was saved to that folder.

- Create another distinct button.
- Click Apply.
- Verify that the previous folder contains the new button as well.

Change-Id: I1d1ff9f49485ea684c7d1e031448a11a80328c6f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269775
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Guilherme Baron <gbaron@instructure.com>
QA-Review: Guilherme Baron <gbaron@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-08-04 21:04:52 +00:00
Weston Dransfield d06bc400ee Cleave files browser folders API
Closes MAT-296
flag=none

Depends on g/268478

Test Plan:
- Verify g/268478 is checked out in RCS
- Navigate to a coures files page and create
  at least 100 folders (to test pagination)
- Navigate to an RCE instance in that course
  as a teacher
- Click "Course Documents" in the RCE toolbar
- In the tray, change the "Documents" select
  to "All" to display the file browser
- Verify Coures and User root directories
  are displayed
- Expand the coures folder and verify all
  100+ sub folders are displayed
- Insert a link to a file and verify insertion
  works
- As a student, visit an RCE instance. Follow
  the same steps as above to view the file browser
- Verify user files are visible and can be inserted
- As a student, visit an RCE in a group context.
  Verify both user and group files are visible
  in the RCE file browser
- Visit an RCE in an account context (the
  announcements page, for example).
- Verify user files are visible and can be inserted
  from the RCE file browser

Change-Id: I15467ae4d8b33f649311038948608b4b43e3a265
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268227
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Juan Chavez <juan.chavez@instructure.com>
QA-Review: Juan Chavez <juan.chavez@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-07-28 20:21:29 +00:00
Juan Chavez 4f0fd3dc71 Clean &nbsp; when uploading images in RCE
fixes MAT-265

flag=none

test plan
- Navigate to a RCE instance
- Click images button
- Upload an image from computer
- Switch to HTML view
- Verify that there is no &nbsp; after <img> tag

Change-Id: I1d079396f5261547fee01f1a19a22ad8f157738f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/269602
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Juan Chavez <juan.chavez@instructure.com>
2021-07-23 17:19:19 +00:00
Ed Schiebel 04fe2556c3 Reorganize some of the CanvasRce properties
closes MAT-328
flag=rce_enhancements

It was very confusing having 2 components named CanvasRce, so
the one in the canvas-rce package was renamed to simply RCE.

That the props for menu, toolbar, and plugins were not consistent
between canvas' CanvasRce and the RCE's CanvasRce was a source
of confusion (and just wrong). This moves them into the editorOptions
property where are all the way through the component hierarchy.

test plan:
  - from the canvas-rce directory run yarn demo:dev
  > expect the custom toolbar and menu options to work
  > expect the readonly prop to work (something was broken there too)

  - enable the site_admin feature "Assignment Enhancements - Student"
  - create a text entry assignment
  - as a student, go to the assignment and submit you work
  > expect the page to work like before

Change-Id: I982c7c54750e7a3d9e230e0ab6d16bd078ce9030
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268505
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-07-10 13:23:49 +00:00
Ed Schiebel f3fa945480 Pull lti tool favorites from INST.editorButtons outside canvas-rce
closes MAT-260
flag=rce_enhancemens

test plan:
  - in account settings, add some lti tools and mark one or two
    as favorites
  - visit a page with the rce
  > expect the favorites to be in the toolbar

Change-Id: I0360ac8bea7bf19881cf7db51935f1bdfe362432
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267576
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-06-23 16:13:20 +00:00
Ed Schiebel c7af7b7e02 Necessary tweaks I discovered adding the CanvasRce component to a page
closes MAT-277
flag=rce_enhancements

Factored these changes out of the changes I had to make for MAT-253 where
the CanvasRce component was put on a real page and tested.

1. update jest.config.js to mock the tinymce-react Editor component
2. add a missing dependency to package.json
3. tweak tests to use the new mock
4. use safe-dereference operator in places where specs might
   not have a fully formed ENV

test plan:
  - this is a tough one. It has to pass jenkins, but beyond
    that it will take the changes for MAT-253 to prove these
    changes do all we need

Change-Id: I5804d1a1f13dbfbc21a3213db92d7afe74e576e6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267427
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-06-22 21:11:02 +00:00
Ahmad Amireh 051ecc181c [instui-7] upgrade canvas to v7 but not planner
fixes FOO-1859

leave canvas-planner's dependency on DateTimeInput (part of v6) for
later

test plan: the world doesn't end

Change-Id: Iedbf1ccf0f815ed96f6f8f7d2a151f263ea35010
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266766
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-06-09 22:18:14 +00:00
Ed Schiebel 5a9d82707b Add support for readOnly property on the RCE
closes MAT-251
flag=rce_enhancements

This is a prop that can change over time while the RCE
is rendered.

Adding this brought into focus some more props refactoring
that needed to be done.

test plan:
  - run yarn demo:dev
  - toggle the readonly checkbox and click Update
  > expect the RCE to be readonly if checked
  > in readonly mode, the keyboard shortcut and resize
    buttons in the status bar should still be enabled
  > with focus on the kb shortcut button or resize handle
    the right/left arrow keys move focus to the other button

Change-Id: I29cdba948b96665026ccde463646c03612f3a4bd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266379
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-06-08 17:49:40 +00:00
Weston Dransfield 99544e2fa8 Disable inline previews for files uploaded in RCE
Closes MAT-113
flag=rce_better_file_previewing

Test Plan
- Navigate to an RCE instance (in a Canvas wiki page, for example)
- Upload a previewable document from the RCE toolbar (pdf, docx, etc.)
- Hover over the link and choose "link options"
- Verify the "Preview in overlay" radio button is checked
- Save the page
- Click the link to the uploaded document and verify a preview is
  shown in an overlay rather than inline
- Verify you can still edit the link to open inline

Change-Id: I14f586ce97939b6b66b1d2c8ee1e32c81fff3a1c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266424
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: Weston Dransfield <wdransfield@instructure.com>
2021-06-07 22:42:54 +00:00
Ed Schiebel 189015ef1b Simplify RCE property initalization
closes MAT-206
flag=none

- moved some configuration that always has to happen and does not
  depend on canvas into RCEWrapper
- simplified the flow as best as I could. not as much as I had
  hoped, but some things need to wait until tinymce is loaded
  and that complicates matters

test plan:
  - jenkins passes
  - the RCE still works
    > make sure the external tools toolbar button and menu
      item show up if you have any lti tools installed
      and that they don't if you don't
  - the demo app still works

Change-Id: Icb524835bd73f37756c0f7943239b269e10aa7e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265709
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-28 20:33:53 +00:00
Ed Schiebel 2b0cba93d0 Get canvas features into the RCE menu
closes MAT-210
flag=rce_enhancements

test plan:
  - open a page with an RCE
  > expect the insert menu to include links, images, media,
    documents, and equation
  > expect the toolbar to include all that too

  - yarn demo:dev
  - check "canvas exists" and "Update"
  > expect the rce to show all ^that
  - check "canvas does not" exist and "Update"
  > expect the rce not to show imdages, media, documents
    and equation

Change-Id: If3c4020191c66721d535f510c38daf9817bbe08f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265832
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Guilherme Baron <gbaron@instructure.com>
QA-Review: Guilherme Baron <gbaron@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-27 15:21:16 +00:00
Ed Schiebel 33d5c63c9a Move default tinymce config data into canvas-rce
closes MAT-190
flag=none

test plan:
  - passes jenkins
  > the RCE still works
  > in the demo app too
  - in the demo, add the external plugin to various
    toolbars and menus
  > expect it to show up where you put it

Change-Id: I4ba11b8d3a07f6f133a7a416a7029891d0ef3c38
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265382
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-26 15:14:13 +00:00
Ed Schiebel 7b4f0a7993 Add an external plugin to the demo app
closes MAT-196
flag=none

The canvas-independent rce needs an api to let clients
add plugins and place them where they want in the toolbar
and menus.  This adds this function to the RCE and the demo
app, though I'm not convinced it's the correct API. It does
show how it can be done though.

test plan:
  - yarn demo:dev
  - check the "Include test plugin" checkbox
  - pick a toolbar
  - pick a menu
  - click Update
  > expect a wrench button in the selected toolbar and menu
  - click the wrench
  > expect an alert

You can select one of the existing toolbars or menus,
or the (new!) option and it will create a new
toolbar or menu.

Change-Id: I4dde32e136db9ee922e7f183aae165c6c40c6461
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265293
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Guilherme Baron <gbaron@instructure.com>
QA-Review: Guilherme Baron <gbaron@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-20 18:26:36 +00:00
Ed Schiebel 98e03aa2b3 Move a11y checker dependency into canvas-rce
closes MAT-129
flag=none

The tinymce-a11y-checker was a dependency of canvas-lms and
given to the RCE thru some fancy initialization shenanigans.
This change puts it in the new RCE, but leaves it in canvas
for the old rce. We can remove it with MAT-54 when the old
rce is removed.

test plan:
  - open a page with the rce
  - click the a11y checker button in the status bar.
  > expect the a11y checker to open.

  Make sure it still works in the old RCE
  - edit config/feature_flags/00_standard.yml and set
    rce_enhancements.environments.development.state: allowed
  - restart your canvas server
  - from /accounts/site_admin/settings page, feature options tab
    turn RCE Enhancements off
  - load a page with the rce
  > expect the a11y checker to work

Change-Id: I9d9202ee1c9a254e14bcc14298330f8a9ab8a7d4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264851
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-13 20:17:18 +00:00
Ed Schiebel 044846ef96 Refactor in preparation for publishing canvas-media on npm
closes MAT-108
flag=none

Primary changes revolved around getting canvas-media to talk to RCS
instead of directly to canvas. This necessitated passing more
info from canvas -> rce -> canvas-media so it can connect.

In the process, merged the 2 functions that uploaded closed captions
into one.

the change in root.js that lazy loads tinyRCE is to get the
canvas-rce bundle size below size limits, which it blew
after a rebase.

test plan:
  This should work with you config/dynamic_settings.yml
  development.config.canvas.rich-content-service.app-host
  value = 'http://host:port'
  or simply 'host:port'

  - in the RCE, upload a video with closed caption
    using the Media > Upload/Record command.
  > expect the video to show up with CC
  - edit the captions in the video options tray
  > expect the captions to be updated
  > bonus result: no console warning about missing file.name
    prop from ClosedCaptionPanel

  - in the RCE, open Upload Document and select
    a video.
  > expect the video to upload an show up.

  - create a media recording type assignment
  - enable the "Assignment Enhancements - Student" feature
  - as a student, visit the assignment
  - click the "Recort/Upload" button
  > expect the video upload and CC feature to work as expected
  > bonus fix: the CCs should be at the bottom of the video

Change-Id: I7b574bb67998072324954a6b481e0c4d3b3251de
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/264109
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-05-07 21:13:06 +00:00
Ed Schiebel eda6aa1bab Recreate the standalone demo app for working on the RCE
closes MAT-67
flag=none

This mostly resurrects the demo app that was abandoned a while ago,
updated to use the fledgling TheRCE react component instead of
RichContentEditor.loadNewEditor.

In the process I discovered a couple differences in the order of
execution when initializing RCEWrapper, so it has a couple changes.

test plan
  - from the packages/canvas-rce directory, run
    yarn demo:dev
  - once it builds, expect your browser to load
    http://localhost:8080
  > expect to see a working RCE
    note: the a11y checker does not work yet
  > expect the RCE to still load and work in Canvas
    (a sniff test should be sufficient)

Change-Id: I396747056b475c4127125d377f9683f47fa6625a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263543
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-04-29 14:02:58 +00:00
Ed Schiebel ff38f9ffb2 Treat content type 'video' and 'video/*' as videos
closes MAT-43
flag=rce_enhancements

we were looking for specific video content types though canvas will
return a more generic type for media object videos.
This change is already queued to be deployed on beta.

test plan:
  - in the new RCE, upload/record a video
  > expect it to be treated as a video
    - move the caret into it and you'll get the Video Options popup button
  - the same with a video selected from the Course Media panel of the
    content tray
  - the same with a video selected from the All Files panel of the
    content tray

Change-Id: Id9797e6f0529ae7d4eb9a07321d4591a60097e6b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/262594
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-04-09 19:50:05 +00:00
Ryan Shaw 485acb0a05 remove “while(1);” json protection
Closes: COREFE-212

The attack vector this was trying to fix has been fixed in all browsers
since 2011 (https://security.stackexchange.com/questions/155518/)
and so is not a problem in any of the browsers we support

See this answer for more details of what the attack was and how
it is no longer a problem: https://stackoverflow.com/a/2669766/7159335

This will make it a lot easier for all of our api request so we don’t
Have to worry about that anymore

Test plan:
* in a browser where you are logged into canvas
* go to /api/v1/users/self
* it should not have a “while(1);” in front of the json

Change-Id: I3750672c41791040f7fb09b2e35bad7966060101
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/205090
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-03-23 16:21:44 +00:00
Nate Armstrong 23756df492 Fix adding course links in new rce w/ permissions
Users without the "Course Files - add/edit/delete" permission can't
upload files to the course when editing content but they should be
able to add course links.

This change checks for the `containingContextType` when determining when
to show the `Links` option in the toolbar and in the Tray.

fixes LS-1844
flag=none

Test plan:
1. In account settings, disable the "Course Files - add/edit/delete"
  permission for teachers
2. Create a new page as a teacher in a course
3. From the RCE click Insert > Link > Course Links
  - link menu bar button should also work
4. Verify that you can add links to course content

Change-Id: I2812e70e92665dc3237f2e5d7830a538e88d6c3e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258434
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: Nate Armstrong <narmstrong@instructure.com>
2021-02-11 20:43:27 +00:00
Ed Schiebel a5035038b1 Fancy HTML editor for the RCE
closes LS-1733
flag=rce_pretty_html_editor

requires rce_enhancements to be on as well. I'm not sure the
new flag is necesary, and as of PS1, it doesn't fully hide the
new html editor functionality.

The INSTUI CodeEditor component uses CodeMirror v5, which sadly
is not accessible. https://github.com/codemirror/codemirror.next,
or https://codemirror.net/6/ for details on a future version.

For now, the RCE still provides access to the raw textarea if
KB access is needed by the user.

BONUS FEATURE! the html editors can now be viewed fullscreen

test plan:
  - with the Pretty html editor feature flag off
  - click the </> button
  > expect the old boring html editor

  - turn on Pretty HTML Editor feature flag
  - click the </> button
  > expect the deluxe new html editor
  - click the "Raw HTML Editor" link
  > expect the old boring editor
  - click the "Pretty HTML Editor" link
  > expect the pretty editor
  - click the </>
  > expect to be back in the rce
  - shift-click the </>
  > expect the old editor
  - from anywhere, click the fullscreen button (except in safari
    when in the old editor, safari won't fullscreen the textarea so
    the button should be hidden)
  > expect to be in fullscreen
  - if you fullscreened the RCE, you can select "View > HTML Editor"
    from the menubar
  > expect to be in the html editor, fullscreened
  - ESC
  > expect to exit fullscreen
  - edit your content anywhere
  > expect the changed to be reflected everywhere else
  - try it on a discussions or quizzes page with >1 RCE
  > the editors and fullscreen should work as you expect

Change-Id: If5b17b2357a4ff5521f0cb9c42bd6a5a096f2436
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255928
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-01-07 16:03:16 +00:00
Ed Schiebel 2f01279918 RCE's Upload File takes same path as Upload Media
This changes the Upload File dialog so that uploading a media file
now takes the same upload path as the Upload Media dialog, which is
to upload the file directly to notorious, and not to canvas.

closes LS-1405
flag=rce_enhancements

test plan:
  - in the RCE toolbar, choose  Documents > Upload Document
  - upload a video file
  > expect the file to go directly to notorious
    - on clicking Submit, you should see a network call to
      /api/v1/services/kaltura_session, followed by calls
      to notorious' getuioxnf, upload, and addEntry
  > expect the resulting iframe's src to include the media_object_id,
    and not `?mediahref=the/url/to/the/file/in/canvas
  > expect uploads of other file types to still go directly to canvas
  > expect to see the same chain of network requests whether the media
    is uploaded from Upload Media or Upload File

Change-Id: I12690afce8e7277c69878bdffd6075376732eaa3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/248068
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-12-16 22:10:35 +00:00
Ed Schiebel 3989c4f602 RCE file linked from All Files different from Documents tray
closes LS-1708
flag=rce_enhancements

When we link a file via All Files, the url has "/preview" at the end.
This breaks the pretty iframed preview, the inline preview, and logging
user access.

test plan:
  - with the new rce
  - add a file to the RCE using All Files
  - add a file (the same file?) using User or Course Documents
  - save
  - click on the preview icon next to each file
  > expect the preview to open inline right there
  - click the link
  > expect the preview to open in a new tab inside an iframe hosting
    the preview with canvas' nav in the page (it didn't get opened
    raw and all by itself in the tab)

Change-Id: I9507e9b63e8d7dfc010b405af4f7e6aae02b3a4f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255248
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2020-12-16 19:04:12 +00:00
Jackson Howe 24ee8e62b2 Fix rce media placeholder alignment
When inserting media (images, documents, audio, video) into the rce,
the gray placeholder that appeared wasn't always in the right place.
For instance, links to images and documents should have an inline
placeholder. Images' placeholders should be centered in the middle
of the line (vertically), since that's how we display images, and
video/audio placeholders should be aligned to the bottom of the line,
since that's how we show this kind of media.

flag = rce_enhancements
fixes LS-1594

Test plan:
 - Insert the following into the rce (by uploading; media that's
   already uploaded doesn't get a placeholder):
   a small image, a large image, a PDF document, an audio file, a
   video file, and an image set to display as a link
 - Check out the placeholder that appears (can reduce network speed
   in dev tools if needed)
 - Once the placeholder is replaced by the uploaded content, expect
   the content to be in the same place and size as the placeholder

Change-Id: Ibbbbb583887ac0e5c26bc95e10a177261828b92d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254612
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
Reviewed-by: Jeff Largent <jeff.largent@instructure.com>
2020-12-10 20:03:41 +00:00
Jeremy Stanley 1b34bdd2db fix cross-shard user-context Inst-FS uploads from RCE
test plan:
 - enable the new RCE
 - have two Canvas shards configured (I am sorry)
 - have Inst-FS configured and able to work with both shards
   probably by configuring it in site admin (I am very sorry)
 - from a student who is native to one shard, attempt to
   upload a file to a discussion reply in a course in the
   other shard, via the "Upload Document" or "Upload Image" button
 - the file should be uploaded and attached

fixes LS-1578

Change-Id: I90707e26e73caf1def79f391a396fade4c6d8c54
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252919
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: Jeremy Stanley <jeremy@instructure.com>
2020-11-24 16:22:16 +00:00
Ed Schiebel ffe235616a Add search to All files
closes LS-1519
flag=rce_enhancements

Back when I added sortBy I chose to bypass putting it in the redux store
for passing the current value down when calling the functions that
eventually make the ajax calls. When adding search, I followed the same
pattern.  It started to become apparent that this was a mistake when
adding search to the Links pane in the tray, but I stuck with it.  Adding
search to the the All Files FileBrowser was the straw that broke it.
In hindsight, my original decision was wrong, colored by my dislike for
redux.  This commit, in addition to adding search to All Files, moves
sort and search into the redux store.  Though the commit looks huge,
it's not as bad as it looks as many of the changes are the same across
slices thru the code for documents, images, media, and links.

The end result is code that's cleaner and more robust in the face of
sorting and searching while the user switches among tray panes, opens
different Link accordion sections, or opens and closes folders in the
file browser.

I'll be glad to walk whoever is CRing this through the changes.

test plan:
  - open all files
  - enter something in the search box
  > expect the "x" clear button to appear
  > expect the files to match
  - open some other folders
  > expect the files in the newly opened folders to match
  - change the search string
  > expect the files in all the open folders to match
  - click the "x" button
  > expect the search field to be cleared
  > expect the the clear  button to disappear
  > expect all the files to be listed

  - enter something in the search box
  - navigate between panels (Documents, Images, Media, Links, All Files),
    contexts (User, Course, Group), and Link accordian sections
  > expect the results to match the current search string

  - it would help if you set DEFAULT_CANVAS_PER_PAGE_ARG in
    canvas-rce-api/app/api/wrapCanvas.js to something
    smaller than 50
  > expect the "Load More" button should load more matching the
    search string
  > expect it not to duplicate the first batch of results

  - open any of the panels
  > while data is loading
    > expect the search input text box to be readonly
      (not disabled, because then it will lose focus)
    > expect the message to change from a search hint to
      a loading message

Change-Id: Ief6cb9f751f0b519efa9a078248e12cf1fc836f9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252389
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: Robin Kuss <rkuss@instructure.com>
2020-11-17 17:53:13 +00:00
Ed Schiebel 310be444fe Use the right image URL from RCE's All Files
closes LS-1536
flag=rce_enhancements

2 changes
  1. use the file URL including the context (e.g. /users/17/files/19)
     rather than the raw file url (e.g. /files/19)
  2. fixed a bug where /users/17/files/19/preview became
     /users/17/files/19/preview/preview

test plan:
  - in the new RCE
  - add an image from Images pane
  > expect to see it
  - add an images from All Files
  > epxect to see it
  - add a link to another file type
  - save
  > expect to see the images
  - click on the link
  > expect the preview tab to open

Change-Id: I8845546e994a16e530241dc8c08a839ace09628a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252809
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-11-17 13:15:32 +00:00
Ed Schiebel 9ed2f77a1c Add search to the RCE's course links tray
closes LS-1574
flag=rce_enhancements

Be sure to rebase you canvas-rce-api.

test plan:
  - in the RCE, open Links > Course Links
  - expand one of the accordion sections
  - enter at least 3 chars in the search box
  > expect the list of links to match the search
  > expect focus to remain in the search box
  - open a different accordion section
  > expect the list of links to match the previous search
  - click the x clear button
  > expect to see all the links

  - close and reopen the tray
  > expect the search textbox and clear button to be disabled
    while data is being loaded (the spinner is showing).
  - type something in the search box
  > expect the search box to be readonly and clear button
    to be disabled while data is being loaded

Change-Id: Iae98489ac80098966abbca7c4df0dda4d39b1a7a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251029
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-11-10 18:50:42 +00:00