Installing the SourceDialog Plugin on CKeditor 4 - ckeditor4.x

I have CKeditor 4 working fine; but I needed to add the 'source' button so we can edit in HTML. This is not an inline version, it's in the CMS for editing page content.
I pasted the plugins into the plugins directory for Sourcedialog, Dialog, DialogUI and also Sourcearea.
My config.js now reads:
CKEDITOR.editorConfig = function( config ) {
config.extraPlugins = 'savebtn';//savebtn is the plugin's name
config.saveSubmitURL = 'ajax-wysi-next.cfm';//link to serverside
script to handle the post
config.extraPlugins = 'sourcedialog';
config.extraPlugins = 'sourcearea';
config.extraPlugins = 'dialog';
config.extraPlugins = 'dialogui';
};
I am not seeing the Source button appear, even after clearing cache.
Do I need to do anything else?

Ok, so this got fixed like this:
Install the SourceDialog plugin and the plugins it depends on (Dialog, DialogUI).
Change config.js to have references to them:
config.extraPlugins = 'sourcedialog';
config.extraPlugins = 'dialog';
config.extraPlugins = 'dialogui';
Then, go to the page where you have the CKeditor installed and change it to read:
extraPlugins: 'savebtn, sourcedialog',
The important thing being that you put the plugins in this same field, separated by a comma, and NOT do an 'extraPlugins' line for each plugin.
Now both the Source button and my Save button are working fine.
Hope this helps others!

Related

Cypress: Prevent open new tab with link dynamically created and clicked

I want to test a file download. It is made programmatically on click a button that uses this function:
export function downloadURI(uri, target) {
const link = document.createElement('a')
if (target) link.target = target
link.href = uri
link.click()
}
The problem is that when you do cy.click() on that button the new tab is opened and the tests fail. I am checking that the download is successful by asserting the loading modal is visible after clicking the button (while the file is being generated via an HTTP request) and is Not visible after the download was generated.
How can I prevent this tab from opening so that the tests do not fail?
This works for me:
cy.get('a').invoke('removeAttr', 'target').click()
From the official document it says that cypress does not support multiple tabs testing.
Also there is a recipe including 3 solutions about how to handle this.
Have a read and see if it can help.

Problem configuring CKEDITOR in Magnolia RichTextField

I can't customize toolbar buttons in Magnolia's RichTextField
in Yaml file add configJsFile: /ckeditor/configJsFile.js pointing to config file under resource folder in java module project
- name: text
class: info.magnolia.ui.form.field.definition.RichTextFieldDefinition
configJsFile: /ckeditor/configJsFile.js
i18n: true
once configJsFile.js added RichTextField start showing up all imaginable buttons and it is too many
I tried to remove some buttons groups in configJsFile.js even comment out all content inside config funtion CKEDITOR.editorConfig = function( config ) { ... } that's make any effect.
Any idea how I can configure toolbar content in Magnolia's RichTextField?
Here is original configJsFile.js taken from Magnolia doc site
Which version of Magnolia are you using?
Worst case scenario you can change the default settings from
'ckeditor/config-default.js'
Hope that helps,
Cheers,
I was wrong assuming that magnolia pointed to java resources.
Once I put CKEditor config file into folder from magnolia properties I've got what I wanted
see magnolia.resources.dir=${magnolia.home}/modules

How can I disable the Preview button while in Source Mode with CKEditor 4?

We are using the latest version 4.7.3 of CKEditor (Full) available from nuget. We've tried a number of suggested solutions to disable the Preview toolbar button while in Source Mode, but could not get it to work. There are cases when there are more than one editor on a page, and they are added as user controls (.ascx) due to some unrelated logic. For example we've tried the below:
CKEDITOR.on('instanceReady', function (instance) {
instance.editor.addCommand('preview', {
modes: { wysiwyg: 1, source: 0 }
});
});
We configure the toolbar buttons via config.js.
CKEDITOR.editorConfig = function (config) {
config.toolbar_CMToolbar =
[
{ name: 'sourcedialog', items: ['Source', '-', 'Preview'] }
];
};
The reason we need this is to avoid a security issue when malicious script has been added while in Source Mode and the Preview was immediately requested, causing javascript to execute. Ordinarily the wysiwyg mode would clean this up and the malicious scripts would have been validated.
Below is the sample script that triggers the issue, for reference. (include everything from double-quote to tag close)
"><img src=x onerror=alert(7)>
Granted this is just evading the main issue rather than fixing it, but this workaround would be handled quicker.
Hoping to hear suggestions on how to correct this. Thanks!
You can change properties of commands like this:
CKEDITOR.on('instanceReady', function(evt) {
evt.editor.commands.preview.modes.source = 0;
});

CAPTCHA does not look like the way it should in my contact form in Joomla

I'm new to Joomla and recently I've tried a lot to enable captcha for my contact forms and I've done all the steps to do it. (enabling captcha in Plugins,global configuration and user manager) but after all I just see this in my form:
*Security Code(Captcha)
and the code itself and the textfield to enter the captcha code are not displayed.
what should I do??? As I said I'm new to Joomla please explain step by step. By the way my site's language is Persian(Although it is not important)
this is how my form looks like after enabling captcha:
My form after enabling CAPTCHA
After 24 hours of searching on the net finally I found the answer.
Under the site's Home directory You must go to:
public_html -> plugins -> captcha -> recaptcha
and open the file named recaptcha.php.
Search for the pieces of code mentioned bellow and make the following changes:
change
const RECAPTCHA_API_SERVER = "http://api.recaptcha.net";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";
To
const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "www.google.com";
and also change
$response = $this->_recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/verify"
To
$response = $this->_recaptcha_http_post(self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify"
Then save and reload your page. it's done.
Don't forget that this is needed in Joomla 2.5 where the version of RECAPTCHA is 1.0 if your Joomla is a newer version you don't need to change anything just enable RECAPTCHA.

lotusSpellChecker and ckeditor Xpages?

I'd like to activate the spellcheck plugin in CKEditor but it seems that IBM has disabled the native plugin.
Looking at the config.js in the data\domino\html\ckeditor directory on the Domino server I see this code describing a plugin called lotusSpellChecker but enabling this plugin doesn't seem to do anything.
config.lotusSpellChecker = {
restUrl:'',
lang:'en',
suggestions:'5',
format:'json',
highlight: { element : 'span', styles : { 'background-color' : 'yellow', 'color' : 'black' } },
preventCache: true
};
Does anybody know how to activate this plugin and why the native one has been disabled?
I've only successfully activated the built-in spell checker by downloading the latest CKEditor release, copying it to the server and using that on an Xpage. See my post on the XPage forum for details:
http://www-10.lotus.com/ldd/xpagesforum.nsf/topicThread.xsp?action=openDocument&documentId=A198C7153DBD84348525798B0056DC6B
I've tried activating it in the default CKEditor installation but couldn't get it to work.
I can't make an official statement as to why it is disabled, but it is most likely for licensing reasons.
CKEditor uses Web Spell Checker. Details are here.
http://www.webspellchecker.net/
The plugin can be activated by making some changes to the config.js file located in the ckeditor folder. Uncomment the folowing block:
//Example Lotus Spell Checker config.
/*
config.extraPlugins += ',lotusspellchecker';
config.lotusSpellChecker = {
restUrl:'',
lang:'en',
suggestions:'5',
format:'json',
highlight: { element : 'span', styles : { 'background-color' : 'yellow', 'color' : 'black' } },
preventCache: true
};
*/
Note: you need to provide the restUrl of whatever spell checking service you are going to use. Instructions here only solve the "how to activate plugin" question.
You also need to provide some Dojo properties in your rich text control:
This one adds the spell check button (LotusSpellChecker) to the toolbar.
Property name: toolbar
Property value: var myToolbar = "[['Format', 'Font','FontSize'], \n"
+"['Bold','Italic','Underline','Strike','-','TextColor','BGColor','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','NumberedList','BulletedList'], \n"
+"['Indent','Outdent'], \n"
+"['Subscript','Superscript'], \n"
+"['RemoveFormat', '-','MenuPaste','-','Undo','Redo','Find','LotusSpellChecker','-','Image','Table','Link','Flash','-','PageBreak','HorizontalRule','SpecialChar','Blockquote','Smiley','ShowBlocks'], \n"
+"['BidiLtr','BidiRtl'], \n"
+"['Maximize']]";
return myToolbar;
This one activates the plugin.
Property name: extraPlugins
Property value: lotusspellchecker
This is what you get:
Domino 9.0.1 FP2 adds spell checker functionality through the default CKEditor toolbar and through the 'IbmSpellChecker" toolbar button.
I have an update on this. SPR PHAN8R2GRE is created to look at including this functionality in a later release. In case you need to add a customer report to it.
All modern browsers come with spell checking capabilities which should activate for you on the field.

Resources