@brightspace-ui/htmleditor
Advanced tools
Comparing version 0.0.2 to 0.0.5
@@ -20,2 +20,3 @@ import '@brightspace-ui/core/components/colors/colors.js'; | ||
import { RtlMixin } from '@brightspace-ui/core/mixins/rtl-mixin.js'; | ||
import { tinymceLangs } from './generated/langs.js'; | ||
@@ -36,3 +37,2 @@ // To update from nre tinyMCE install | ||
// TODO: review allow_script_urls (ideally we can turn this off) | ||
// TODO: review resize (monolith specifies both, but this would require enabling statusbar) | ||
// TODO: review auto-focus and whether it should be on the API | ||
@@ -42,2 +42,16 @@ | ||
const documentLang = (document.documentElement.getAttribute('lang') ?? 'en').replace('-', '_'); | ||
let tinymceLang = documentLang; | ||
if (!tinymceLangs.includes(documentLang)) { | ||
const cultureIndex = tinymceLang.indexOf('_'); | ||
if (cultureIndex !== -1) tinymceLang = tinymceLang.substring(0, cultureIndex); | ||
if (!tinymceLangs.includes(tinymceLang)) { | ||
tinymceLang = tinymceLangs.find((lang) => { | ||
return lang.startsWith(tinymceLang); | ||
}); | ||
if (!tinymceLang) tinymceLang = 'en'; | ||
} | ||
} | ||
const pathFromUrl = (url) => { | ||
@@ -147,3 +161,2 @@ return url.substring(0, url.lastIndexOf('/')); | ||
const textarea = this.shadowRoot.querySelector(`#${this._editorId}`); | ||
const locale = 'en-US'; | ||
@@ -188,4 +201,4 @@ const fullPageConfig = {}; | ||
inline: this.inline, | ||
language: locale !== 'en-US' ? locale : null, | ||
language_url: `/tinymce/langs/${locale}.js`, | ||
language: tinymceLang, | ||
language_url: `/tinymce/langs/${tinymceLang}.js`, | ||
menubar: false, | ||
@@ -192,0 +205,0 @@ object_resizing : true, |
{ | ||
"name": "@brightspace-ui/htmleditor", | ||
"description": "An HTML editor that integrates with Brightspace", | ||
"version": "0.0.2", | ||
"version": "0.0.5", | ||
"repository": "https://github.com/BrightspaceUI/htmleditor.git", | ||
@@ -11,5 +11,9 @@ "publishConfig": { | ||
"htmleditor.js", | ||
"icons.js", | ||
"/generated", | ||
"/tinymce" | ||
], | ||
"scripts": { | ||
"build:langs": "node ./cli/lang-generator.js", | ||
"build": "npm run build:langs", | ||
"lint": "npm run lint:eslint && npm run lint:style && npm run lint:lit", | ||
@@ -36,2 +40,3 @@ "lint:eslint": "eslint . --ext .js,.html", | ||
"babel-eslint": "^10", | ||
"chalk": "^4", | ||
"deepmerge": "^4.2.2", | ||
@@ -38,0 +43,0 @@ "es-dev-server": "^1", |
# d2l-htmleditor | ||
[![NPM version](https://img.shields.io/npm/v/@brightspace-ui/htmleditor.svg)](https://www.npmjs.org/package/@brightspace-ui/htmleditor) | ||
[![Dependabot badge](https://flat.badgen.net/dependabot/BrightspaceUI/htmleditor?icon=dependabot)](https://app.dependabot.com/) | ||
[![Build status](https://travis-ci.com/@brightspace-ui/htmleditor.svg?branch=master)](https://travis-ci.com/@brightspace-ui/htmleditor) | ||
@@ -6,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3194884
189
45457
19
89