Drupal Wiris integration - drupal-7

I followed this tutorial to install the Wiris plugin on a new installation of Drupal.
Once the installation was complete and I clicked on the Wiris icon to begin adding a formula, the popup window does NOT load and I get the following error in the console area:
Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin '/DrupalQuiz/sites/all/libraries/ckeditor/plugins/ckeditor_wiris/' in a call to 'postMessage'.
at http://*.*.*.*/DrupalQuiz/sites/all/libraries/ckeditor/plugins/ckeditor_wiris/core/core.js:19:22
The code causing the problem is as follows:
e.source.postMessage(postVariable, _wrs_conf_path);
I'm at a loss how to deal with this issue.

I don't have a complete fix but I was able to get it working locally by replacing _wrs_conf_path with the base path of my dev box. _wrs_conf_path was evaluating to a relative path to the plugins folder.
if (typeof(e.source) != 'undefined') {
e.source.postMessage(postVariable, _wrs_conf_path);
}
with
if (typeof(e.source) != 'undefined') {
e.source.postMessage(postVariable, _wrs_currentPath);
}
in the /sites/all/libraries/ckeditor/plugins/ckeditor_wiris/core/core.js file.
Edit: I replaced _wrs_conf_path with one of their internal variables _wrs_currentPath and that seemed to fix the issue.

Related

Error in Jimp.loadFont (use load-bmfont module) with React

I am testing Jimp.js for image manipulation (using React with react-scripts, npm: 6.14.4, node: v12.16.3)
Everything is going well except writing text on a loaded image
import Jimp from 'jimp'
Jimp.read(image)
.then(image => {
console.log('image loaded', image)
Jimp.loadFont(Jimp.FONT_SANS_32_WHITE).then(font => {
console.log('font loaded', font)
image.print(font, 10, 10, 'Hello world that wraps!', 12)
// write image
})
})
This throws an error "error parsing font malformed file -- no element" in browser.js of load-bmfont module line 71 and dont execute the log 'font loaded'.
Googling not help i found only 2,3 items about this, associate with using custom fonts - but i use standard font from Jimp. (Using BMFont files instead of Jimp standard fonts doesnt help)
My first thought was the error ocured in a React App in the browser, so i write a Jest test to see if its work without browser context but it fail just like that.
Got any ideas?
Solved...
I'm using the React App within a Java Web Framework in a JSP File.
Jimp.loadFont(Jimp.FONT_SANS_32_WHITE)
search the font in a path that doesn`t exist for the webapp.
Moving the font files to a reachable path with context root
Jimp.loadFont(`${CONTEXT_ROOT}/foo/bar/font.font`) works.

Android Manifest merger error in Codename One

In a bare bones project, I added these build hints:
android.gradleDep=compile 'com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.5'
android.min_sdk_version=23
I would like to import the following Android library to make a CN1Lib (that requires at least Android SDK 23):
https://github.com/erikagtierrez/multiple-media-picker
To be short: I spent one day trying to import that, I also experimented with Android Studio and with suggestions found on Stack Overflow (trying to make a custom .aar), without success.
Could you help me to import that library? There is manifest merger error.
In fact, the issue reported by the build server is:
* What went wrong:
Execution failed for task ':processReleaseManifest'.
> Manifest merger failed : Attribute application#label value=(BareBones) from AndroidManifest.xml:15:17-42
is also present at [com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.5] AndroidManifest.xml:23:9-41 value=(#string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:15:3-43:103 to override.
I also tried to add the build hint:
android.xapplication_attr=tools:replace="android:label"
as suggested by the previous error, without success.
In the last case, I get:
Merging result: ERROR
/tmp/build1659178556337293135xxx/Test/src/main/AndroidManifest.xml:15:3-43:103 Error:
tools:replace specified at line:15 for attribute android:label, but no new value specified
/tmp/build1659178556337293135xxx/Test/src/main/AndroidManifest.xml Error:
Validation failed, exiting
-- Merging decision tree log ---
The last full log is here: https://gist.github.com/jsfan3/dd6c23f86a2ac949f996910c8cece62b
Thank you
This is happening because our code things you injected android:label on your own and doesn't inject it to avoid collision...
Change the code to this:
android.xapplication_attr=tools:replace="android:label" android:label="App Name"

Uncaught ReferenceError: Popper is not defined

I just started working on a project that was developed by another developer (reactjs project) , however when I try to start the project I get this error in the browser console :
Uncaught ReferenceError: Popper is not defined
The error is pointing to a specific line of course which is in the file :
node_modules/bootstrap/dist/js/bootstrap.js
the error in the last line of the following :
var bootstrap = (function (exports,$,Popper) {
'use strict';
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
// a lot of generated code
}({},$,Popper));
As I said earlier the error shows up pointing to the last line with the error mentioned before
Note : I have searched all other possible answers here in stack overflow but with no luck , including this answer Bootstrap 4: Uncaught ReferenceError: Popper is not defined so please it is not a duplicate
The problem was not in the code , the problem was that I had an old version of nodejs and npm on my machine I thought this might help someone in the future.

proguard.ParseException: Unknown option '-encryptstrings' in proguard.cfg

When I run mvn install goal with progurad option then am getting the following error. Previously, I don't have this error. I could not find what has made the difference in getting the following error:
proguard.ParseException: Unknown option '-encryptstrings' in line .. of file 'proguard.cfg'
I am using dexguard for my project. is this error because of the maven could not identify the dexguard folder location?
proguard.cfg content:
-dalvik -- unknown option
-android -- unknown option
# Encrypt all strings -- parse exception
-encryptstrings '???*'
The following works with out issues:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic
-optimizationpasses 30
-allowaccessmodification
-dontpreverify
-dontoptimize
-ignorewarnings
-renamesourcefileattribute Maviance
-keepattributes SourceFile,LineNumberTable,*Annotation*
-keep,allowshrinking,allowobfuscation class android.support.**Compat* { *; }
The option -encryptstrings '???*' is only supported by DexGuard. So when you use ProGuard to build your application, you will receive such an error.
Thus it is advised to separate the dexguard related configuration into a separate config file dexguard-project.txt that is only included when using DexGuard.
I had the same error using dexguard. The problem was that I was missing this line
proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')
So gradle took Proguard instead of Dexguard, which obviously doesn´t have the encryptstrings feature. So the working release configuration is this:
release {
debuggable true
minifyEnabled true
proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')
signingConfig signingConfigs.release
}

Grunt uglify fail while with JS Parse error

I've created an Angular app which works fine on locally.
However when I try to build (grunt build) to generate the dist folder that will contain my app with everything minified and ready to deploy, I have a error at the Uglify step.
Error:
JS_Parse_Error {
message: 'Unexpected token operator «=», expected punc «,»',
filename: '../../.tmp/concat/scripts/scripts.js',
...
I've read that people had similar errors, just the operator was a different one in the error message.
If someone has a clue.
My issue came from the function's parameters with a default value.
For example:
function (a = myValue, b) {
...
For some reason, giving that default value was not supported.
I replaced it by doing something like:
function (a, b) {
a = typeof a !== 'undefined' ? a : myValue;
...
You will find explanations of that behaviour by googling (uglify, ES6), I'm just offering the solution of my specific error.

Resources