Skip to content

Commit

Permalink
fix(tinymce6): add formulas to undoManager
Browse files Browse the repository at this point in the history
  • Loading branch information
icaparros-at-wiris committed Oct 23, 2023
1 parent dd46343 commit 1562df2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
13 changes: 13 additions & 0 deletions packages/tinymce6/editor_plugin.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ export class TinyMceIntegration extends IntegrationModel {
super.updateFormula(mathml);
}

/** @inheritdoc */
insertFormula(focusElement, windowTarget, mathml, wirisProperties) {
// Due to insertFormula adds an image using pure JavaScript functions,
// it is needed notificate to the editorObject that placeholder status
// has to be updated.
const obj = super.insertFormula(focusElement, windowTarget, mathml, wirisProperties);

// Add formula to undo & redo
this.editorObject.undoManager.add(obj);

return obj;
}

/**
* Set Moodle configuration on plugin.
* @param {string} editor - Editor instance.
Expand Down
1 change: 1 addition & 0 deletions packages/tinymce6/plugin.min.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions packages/tinymce6/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = (config, context) => {
filename: './plugin.min.js',
globalObject: 'this',
},
devtool: "source-map",
devServer: {
devMiddleware: {
writeToDisk: true,
Expand All @@ -28,7 +29,7 @@ module.exports = (config, context) => {
// Set watch to true for dev purposes.
watch: false,
optimization: {
minimize: true,
minimize: false,
minimizer: [new TerserPlugin({
// These options prevent Terser from generating a LICENSE.txt file
terserOptions: {
Expand Down Expand Up @@ -82,9 +83,9 @@ module.exports = (config, context) => {
stats: {
colors: true
},
experiments: {
topLevelAwait: true,
asyncWebAssembly: true
experiments: {
topLevelAwait: true,
asyncWebAssembly: true
},
plugins: [
new webpack.EnvironmentPlugin({
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19210,9 +19210,9 @@ tinymce@^5.5.1, tinymce@^5.7.1, tinymce@^5.8.2, tinymce@^5.9.2:
integrity sha512-9UUjaO0R7FxcFo0oxnd1lMs7H+D0Eh+dDVo5hKbVe1a+VB0nit97vOqlinj+YwgoBDt6/DSCUoWqAYlLI8BLYA==

tinymce@^6.0.0:
version "6.6.1"
resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.6.1.tgz#02aacf662c546047225f66444301a0b488b6fe26"
integrity sha512-n1ub/Jq6c5o2mju6A1HPFoR5/X7eH8720yDzLchg4MbKKJg6tthTGr+lBPHzQyrImwbfo7LVgx28mN5InzVMmw==
version "6.7.0"
resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.7.0.tgz#0ec245502cdefbfa0ff9042b423ac9a01e781423"
integrity sha512-Wf2RSobIXQ7XNw3/v4z1lPGiH3Pjsmc/6/7fG28aIS6uVWj/7IhvOPuwfJJDeOx0o0D3nSnoLHgR2KU8JAdE+w==

tmp@^0.0.33:
version "0.0.33"
Expand Down

0 comments on commit 1562df2

Please sign in to comment.