npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@instructure/canvas-rce-old

v4.1.5

Published

A component wrapping canvas's common tinymce usage

Downloads

96

Readme

Canvas Rich Content Editor

The Canvas LMS Rich Content Editor extracted in it's own npm package for use across multiple services. This npm module is used in pair with a running canvas-rce-api microservice.

You need a running instance of the canvas-rce-api in order to utilize the canvas-rce npm module, but you do not need that instance in order to do development on canvas-rce. (see docs/development.md)

The first customer of the canvas-rce was the canvas-lms LMS so documentation and references throughout documentation might reflect and assume the use of canvas-lms.

Install and setup

As a published npm module, you can add canvas-rce to your node project by doing the following:

npm install canvas-rce --save

Please reference the canvas-lms use of canvas-rce to get an idea on how to incorporate it into your project. Pay special attention to the RichContentEditor.js and serviceRCELoader.js.

Polyfills

This project makes use of modern JavaScript APIs like Promise, Object.assign, Array.prototype.includes, etc. which are present in modern browsers but may not be present in old browsers like IE 11. In order to not send unnecessarily large and duplicated code bundles to the browser, consumers are expected to have already globally polyfilled those APIs. Canvas already does this but if you need suggestions for how to this in your own app, you can just put this in your html above the script that includes canvas-rce:

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?rum=0"></script>

(See: https://polyfill.io/v2/docs/ for more info)

Development

Upgrading TinyMCE

Language Packs

Translations for TinyMCE are not shipped with the tinymce npm package. When upgrading to a new version be sure to download the latest language packs. Visit https://www.tinymce.com/download/language-packages/ and select all languages. It is easier to just download all and only commit the changes to existing files than try to only select the locales currently used. Download the file and extract all of th .js files to ./src/rce/languages/. After commiting the changed locale files you can run git clean -f ./src/rce/languages/ to remove the untracked language files.

Adding Languages

TinyMCE Language Pack

Download the new TinyMCE language pack by visiting https://www.tinymce.com/download/language-packages/ and select the language. Copy the JavaScript file to ./src/rce/languages/.

Locale Code Mappings

Since different projects have a hard time agreeing on locale code format, a file mapping Canvas locale codes to TinyMCE locale codes needs to be updated. This is found in ./src/rce/editorLanguage.js.

Recognized Languages

The ./src/rce/normalizeLocale.js file includes a list of valid locales. The new locale should be added here.

Locale Module

A locale module should be added for each new locale, with a name matching the Canvas locale code. This file adds the translations to the canvas-rce formatMessage namespace, and loads the TinyMCE translations.

Example

import formatMessage from "../format-message";
import locale from "../../locales/locale-code.json";
import "../rce/languages/tinymce_locale";
formatMessage.addLocale({ "locale-code": locale });