Skip to content

Commit

Permalink
SAK-49520 CKEditor: Added FMath plugin (sakaiproject#12150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Pellicer authored Dec 20, 2023
1 parent 321265a commit 722f959
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
21 changes: 21 additions & 0 deletions library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<npm-version>6.14.15</npm-version>
<!-- Default extra plugins enabled -->
<ckeditor-extra-plugins>sakaipreview,sakaidropdowntoolbar,sakaiopenlink,</ckeditor-extra-plugins>
<!-- Default math extra plugins enabled -->
<ckeditor-math-extra-plugins></ckeditor-math-extra-plugins>
<!-- Empty defaults for a11y-->
<ckeditor-a11y-extra-plugins></ckeditor-a11y-extra-plugins>
<sakai.skin.source>default</sakai.skin.source>
Expand Down Expand Up @@ -95,6 +97,12 @@
<version>${ckeditor.html5video.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>ckeditor4-fmath-editor</artifactId>
<version>${ckeditor4.fmath.editor.version}</version>
<scope>runtime</scope>
</dependency>
<!--Used in Resources, drag&drop resources -->
<dependency>
<groupId>org.webjars.npm</groupId>
Expand Down Expand Up @@ -694,6 +702,19 @@
</dependency>
</dependencies>
</profile>
<profile>
<!-- To enable the FMATH plugin in the CKEditor compile with the flag -Dckeditor-fmath -->
<id>ckeditor-fmath</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>ckeditor-fmath</name>
</property>
</activation>
<properties>
<ckeditor-math-extra-plugins>FMathEditor</ckeditor-math-extra-plugins>
</properties>
</profile>
</profiles>
<build>
<plugins>
Expand Down
9 changes: 7 additions & 2 deletions library/src/webapp-filtered/editor/ckeditor.launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sakai.editor.editors.ckeditor = sakai.editor.editors.ckeditor || {} ;
//get path of directory ckeditor
var basePath = "/library/editor/ckextraplugins/";
var webJars = "/library/webjars/"
var fmathPath = webJars + 'ckeditor4-fmath-editor/${ckeditor4.fmath.editor.version}/'

// Update properties in one object from another: https://stackoverflow.com/a/12534361/3708872
// I believe this is available as lodash.merge but don't see that available here yet and this looked like the simplest version of that
Expand Down Expand Up @@ -341,7 +342,8 @@ sakai.editor.editors.ckeditor.launch = function(targetId, config, w, h) {
(sakai.editor.enableResourceSearch ? 'resourcesearch' : ''),
(sakai.editor.enableSakaiOpenLink ? 'sakaiopenlink' : ''),
`${ckeditor-extra-plugins}`,
`${ckeditor-a11y-extra-plugins}`
`${ckeditor-a11y-extra-plugins}`,
`${ckeditor-math-extra-plugins}`,
].join(','),
// These two settings enable the browser's native spell checking and context menus.
// Control-Right-Click (Windows/Linux) or Command-Right-Click (Mac) on highlighted words
Expand Down Expand Up @@ -380,7 +382,7 @@ sakai.editor.editors.ckeditor.launch = function(targetId, config, w, h) {
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks']
,['A11ychecker']
,['A11ychecker', 'FMathEditor']
].filter(el => el !== undefined),
toolbar_BasicText:
[
Expand Down Expand Up @@ -480,6 +482,9 @@ sakai.editor.editors.ckeditor.launch = function(targetId, config, w, h) {
CKEDITOR.plugins.addExternal('notification',basePath+'notification/', 'plugin.js');
// Accessibility checker has a dependency on balloonpanel
CKEDITOR.plugins.addExternal('a11ychecker',webJars+'a11ychecker/${ckeditor.a11ychecker.version}/', 'plugin.js');
// FMathEditor plugin
CKEDITOR.plugins.addExternal('FMathEditor', fmathPath, 'plugin.js');

/*
To enable after the deadline uncomment these two lines and add atd-ckeditor to toolbar
and to extraPlugins. This also needs extra stylesheets.
Expand Down
1 change: 1 addition & 0 deletions master/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
<ckeditor.balloonpanel.version>4.9.2</ckeditor.balloonpanel.version>
<ckeditor.image2.version>4.22.1</ckeditor.image2.version>
<ckeditor.html5video.version>1.1.1</ckeditor.html5video.version>
<ckeditor4.fmath.editor.version>3.4</ckeditor4.fmath.editor.version>

</properties>
<distributionManagement>
Expand Down

0 comments on commit 722f959

Please sign in to comment.