Richtext editor customization (ckeditor)

Moderator: crythias

Locked
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Richtext editor customization (ckeditor)

Post by ferrosti »

My brains starting to hurt on this one.
All I want to do is to disable the 'normal' klick-spellcheck and enable the scayt spellcheck for instant spellchecking.

I have seen a bugreport from mike opened for ckeditor, but no hints how this piece of software has been customized to OTRSs needs.
How the heck did you OTRS guys do that? The ckeditor config file is empty, but the editor shows all buttons just as usual. I am in no way familiar with java based programming, so some hints would be helpful.
Last edited by ferrosti on 02 Mar 2011, 16:02, edited 2 times in total.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Richtext editor customization (ckeditor)

Post by crythias »

Without trying it:

/opt/otrs/var/httpd/htdocs/js/Core.UI.RichTextEditor.js

line 76:

Code: Select all

            // disable builtin spellchecker.net pluging "scayt"
            removePlugins : 'elementspath,scayt,menubutton,contextmenu',
scayt may not work if you're not connected to the internet and/or can't access svc.spellchecker.net
http://stackoverflow.com/questions/2944 ... ellchecker
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Richtext editor customization (ckeditor)

Post by ferrosti »

No matter what I do, scayt will not show up.
I commented out the whole line, removed scayt from it, etc. But nothing.
After every try I made sure Browser Cache is empty, OTRS js cache and normal cache is deleted and apache2 restarted for the very paranoid.

I am a little stuck here.
Is there an inofficial documentation on how all these Java scripts etc. are implemented? Even the dev doc does not tell anything.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Richtext editor customization (ckeditor)

Post by ferrosti »

*push*

I am still stuck on this one. Should I rather repost it in the development board?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
sfs
Znuny newbie
Posts: 10
Joined: 28 Feb 2011, 15:22
Znuny Version: 3.0.5
Location: Warsaw, Poland

Re: Richtext editor customization (ckeditor)

Post by sfs »

By default scayt is disabled in ckeditor 3.3.2 and newer. In addition to changing the 'removeplugins' setting you also need to add this to var/httpd/htdocs/js/Core.UI.RichTextEditor.js :

Code: Select all

        scayt_autoStartup: true,
Works for me.

And if you want to add the scayt to the toolbar, you should edit Kernel/Output/HTML/Standard/RichTextEditor.dtl which defines buttons available on the toolbar. The default config which includes scayt button can be found here: http://docs.cksource.com/ckeditor_api/s ... olbar_Full
Freedom is a road seldom traveled by the multitude.
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Richtext editor customization (ckeditor)

Post by ferrosti »

THANKS 1000 times!
It works perfectly, though very slowly due to its online checking. But we have planned to buy and setup an own server anyways.
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Richtext editor customization (ckeditor)

Post by ferrosti »

It works smart on our second system, too.
But we are not able to switch it off for more than one session. I can switch it off and write a ticket and in the next ticket it will be back on.
Where can I set this up?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
sfs
Znuny newbie
Posts: 10
Joined: 28 Feb 2011, 15:22
Znuny Version: 3.0.5
Location: Warsaw, Poland

Re: Richtext editor customization (ckeditor)

Post by sfs »

I am not sure what you mean. If you set scayt_autoStartup to true, then you have it enabled by default. If you omit this setting from the file, then scayt remains disabled and you need to add the toolbar button (via editing Kernel/Output/HTML/Standard/RichTextEditor.dtl and Kernel/Output/HTML/Standard/CustomerRichTextEditor.dtl) to manually enable it, each time you open the editor.
Freedom is a road seldom traveled by the multitude.
ferrosti
Znuny superhero
Posts: 723
Joined: 10 Oct 2007, 14:30
Znuny Version: 3.0
Location: Hamburg, Germany

Re: Richtext editor customization (ckeditor)

Post by ferrosti »

That is quite clear. I should have given a better explanation.
Some users do not like to have scayt enabled and may switch it off. It is quite annoying to do this on every ticket and I´d rather have my agents do this once for a session or even as a user setting.

Another question on this comes up.
I have users in many countries using different languages (by agents setting) on the same system (DE, FR, NL, CZ, SK). Is it possible to take the users language as set in his settings as a default for ckeditor/scayt/spelling ?

I am pretty confused, since these lines

Code: Select all

defaultLanguage: Core.Config.Get('UserLanguage'),
language: Core.Config.Get('UserLanguage'),
rather seem to set some config parm to whatever language than GETTING it as I would assume. Where the heck does the value come from or how can I configure it?
Maybe someone can point me in the right direction?
openSuSE on ESX
IT-Helpdesk: OTRS 3.0
Customer Service: OTRS 3.0 (upgraded from 2.3)
Customer Service (subsidiary): OTRS 3.0
+additional test and development systems
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Richtext editor customization (ckeditor)

Post by crythias »

http://docs.cksource.com/ckeditor_api/s ... cayt_sLang
http://www.spellchecker.net/v3/samples/ ... lugin.html
http://wiki.spellchecker.net/doku.php?i ... t#ckeditor

Code: Select all

/var/httpd/htdocs/js/thirdparty/ckeditor-3.4.2/lang$ ls
af.js  el.js     fi.js     is.js          nb.js     sr.js
ar.js  en-au.js  fo.js     it.js          nl.js     sr-latn.js
bg.js  en-ca.js  fr-ca.js  ja.js          no.js     sv.js
bn.js  en-gb.js  fr.js     km.js          pl.js     th.js
bs.js  en.js     gl.js     ko.js          pt-br.js  _translationstatus.txt
ca.js  eo.js     gu.js     _languages.js  pt.js     tr.js
cs.js  es.js     he.js     lt.js          ro.js     uk.js
cy.js  et.js     hi.js     lv.js          ru.js     vi.js
da.js  eu.js     hr.js     mn.js          sk.js     zh-cn.js
de.js  fa.js     hu.js     ms.js          sl.js     zh.js
Core.UI.RIchTextEditor.js has language: ...
but it appears that
scayt_sLang: Core.Config.Get('UserLanguage'),
might be helpful, if they comply.

Where does it come from? Probably user choice/preferences in OTRS.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
sfs
Znuny newbie
Posts: 10
Joined: 28 Feb 2011, 15:22
Znuny Version: 3.0.5
Location: Warsaw, Poland

Re: Richtext editor customization (ckeditor)

Post by sfs »

Well, to have scayt enable/disable as an user setting you need to do some coding. I am not familiar with the OTRS architecture so I don't know what would be the best way. The simplest seems to add additional user preference ('Enable/disable scayt') and then act upon its value when setting ckeditor configuration in var/httpd/htdocs/js/Core.UI.RichTextEditor.js in a similar way as the 'UserLanguage' preference is used to set the ckeditor language.
Freedom is a road seldom traveled by the multitude.
Locked