Ticket #2685: 2685_2.patch

File 2685_2.patch, 13.9 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _whatsnew.html

     
    3737        <p>
    3838                New Features and Improvements:</p>
    3939        <ul>
     40                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2685">#2685</a>] Integration
     41                        with "Web Spell Checker", a <strong>zero installation and free spell checker</strong>
     42                        provided by SpellChecker.net. This is now the default spell checker in the editor
     43                        (requires internet connection). All previous spell checking solutions are still
     44                        available.</li>
    4045                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2430">#2430</a>] In the table
    4146                        dialog it's possible to create header cells in the first row (included in a thead element)
    4247                        or the first column of the table. </li>
  • editor/_source/commandclasses/fckspellcheckcommand_gecko.js

     
    2525var FCKSpellCheckCommand = function()
    2626{
    2727        this.Name = 'SpellCheck' ;
    28         this.IsEnabled = ( FCKConfig.SpellChecker == 'SpellerPages' ) ;
     28        this.IsEnabled = ( FCKConfig.SpellChecker != 'ieSpell' ) ;
    2929}
    3030
    3131FCKSpellCheckCommand.prototype.Execute = function()
    3232{
    33         FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
     33        switch ( FCKConfig.SpellChecker )
     34        {
     35                case 'SpellerPages' :
     36                        FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
     37                        break;
     38
     39                case 'WSC' :
     40                        FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'wsc/w.html', 530, 480 ) ;
     41        }
    3442}
    3543
    3644FCKSpellCheckCommand.prototype.GetState = function()
  • editor/_source/commandclasses/fckspellcheckcommand_ie.js

     
    2525var FCKSpellCheckCommand = function()
    2626{
    2727        this.Name = 'SpellCheck' ;
    28         this.IsEnabled = ( FCKConfig.SpellChecker == 'ieSpell' || FCKConfig.SpellChecker == 'SpellerPages' ) ;
     28        this.IsEnabled = true ;
    2929}
    3030
    3131FCKSpellCheckCommand.prototype.Execute = function()
     
    3939                case 'SpellerPages' :
    4040                        FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
    4141                        break ;
     42
     43                case 'WSC' :
     44                        FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'wsc/w.html', 530, 480 ) ;
    4245        }
    4346}
    4447
  • editor/wsc/ciframe.html

     
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     2<!--
     3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
     4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
     5 *
     6 * == BEGIN LICENSE ==
     7 *
     8 * Licensed under the terms of any of the following licenses at your
     9 * choice:
     10 *
     11 *  - GNU General Public License Version 2 or later (the "GPL")
     12 *    http://www.gnu.org/licenses/gpl.html
     13 *
     14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
     15 *    http://www.gnu.org/licenses/lgpl.html
     16 *
     17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
     18 *    http://www.mozilla.org/MPL/MPL-1.1.html
     19 *
     20 * == END LICENSE ==
     21-->
     22<html>
     23<head>
     24        <title></title>
     25        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     26        <script type="text/javascript">
     27
     28function gup( name )
     29{
     30        name = name.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ) ;
     31        var regexS = '[\\?&]' + name + '=([^&#]*)' ;
     32        var regex = new RegExp( regexS ) ;
     33        var results = regex.exec( window.location.href ) ;
     34
     35        if( results == null )
     36                return '' ;
     37        else
     38                return results[ 1 ] ;
     39}
     40
     41function sendData2Master()
     42{
     43        var destination = parent.parent ;
     44        try
     45        {
     46                if ( destination.XDTMaster )
     47                {
     48                        var t = destination.XDTMaster.read( [gup('cmd'), gup('data')] ) ;
     49                        window.clearInterval( interval ) ;
     50                }
     51        }
     52        catch (e) {}
     53}
     54
     55function onLoad ()
     56{
     57        interval = window.setInterval( sendData2Master, 100 );
     58}
     59
     60        </script>
     61</head>
     62<body onload="onLoad()">
     63        <p></p>
     64</body>
     65</html>
  • editor/wsc/tmpFrameset.html

     
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
     2<!--
     3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
     4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
     5 *
     6 * == BEGIN LICENSE ==
     7 *
     8 * Licensed under the terms of any of the following licenses at your
     9 * choice:
     10 *
     11 *  - GNU General Public License Version 2 or later (the "GPL")
     12 *    http://www.gnu.org/licenses/gpl.html
     13 *
     14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
     15 *    http://www.gnu.org/licenses/lgpl.html
     16 *
     17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
     18 *    http://www.mozilla.org/MPL/MPL-1.1.html
     19 *
     20 * == END LICENSE ==
     21-->
     22<html>
     23<head>
     24        <title></title>
     25        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     26        <script type="text/javascript">
     27
     28function doLoadScript( url )
     29{
     30        if ( !url )
     31                return false ;
     32
     33        var s = document.createElement("script") ;
     34        s.type = "text/javascript" ;
     35        s.src = url ;
     36        document.getElementsByTagName("head")[0].appendChild(s) ;
     37
     38        return true ;
     39}
     40
     41function tryLoad ()
     42{
     43    if ( typeof(opener) == 'undefined' || !opener )
     44        opener = parent ;
     45
     46    // get access to global parameters
     47    oParams = opener.oldFramesetPageParams ;
     48
     49    // make frameset rows string prepare
     50    sFramesetRows = ( parseInt(oParams.firstframeh,10) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ;
     51    document.getElementById('itFrameset').rows = sFramesetRows ;
     52
     53    // dynamic including init frames and crossdomain transport code
     54    // from config sproxy_js_frameset url
     55    var addScriptUrl = oParams.sproxy_js_frameset ;
     56    doLoadScript( addScriptUrl ) ;
     57}
     58
     59        </script>
     60</head>
     61<frameset id="itFrameset" onload="tryLoad();" border="0" rows="30,*,*,0">
     62    <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="2" src="" name="navbar"></frame>
     63    <frame scrolling="auto" framespacing="0" frameborder="0" noresize="noresize" marginheight="0" marginwidth="0" src="" name="mid"></frame>
     64    <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="bot"></frame>
     65    <frame scrolling="no" framespacing="0" frameborder="0" noresize="noresize" marginheight="1" marginwidth="1" src="" name="spellsuggestall"></frame>
     66</frameset>
     67</html>
  • editor/wsc/w.html

     
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     2<!--
     3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
     4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
     5 *
     6 * == BEGIN LICENSE ==
     7 *
     8 * Licensed under the terms of any of the following licenses at your
     9 * choice:
     10 *
     11 *  - GNU General Public License Version 2 or later (the "GPL")
     12 *    http://www.gnu.org/licenses/gpl.html
     13 *
     14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
     15 *    http://www.gnu.org/licenses/lgpl.html
     16 *
     17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
     18 *    http://www.mozilla.org/MPL/MPL-1.1.html
     19 *
     20 * == END LICENSE ==
     21-->
     22<html>
     23<head>
     24        <title></title>
     25        <style>
     26                #wsc_frames , #errorMessage{
     27                        position:absolute;
     28                        top:0px;
     29                        left:0px;
     30                        width:500px;
     31                        height:395px;
     32                        margin:0px;
     33                        padding:0px;
     34                        border:0px;
     35                        display:block;
     36                        overflow: hidden;
     37                }
     38                #wsc_frames   { z-index:10;}
     39                #errorMessage {
     40                        color:red;
     41                        display:none;
     42                        font-size:16px;
     43                        font-weight:bold;
     44                        padding-top:160px;
     45                        text-align:center;
     46                        z-index:11;
     47                }
     48                #errorMessage p {
     49                        color:#000;
     50                        font-size:11px;
     51                        text-align:left;
     52                        font-weight: normal;
     53                        padding-left:80px;
     54                }
     55
     56        </style>
     57        <script type="text/javascript">
     58
     59var oEditor = window.parent.InnerDialogLoaded() ;
     60var FCKConfig = oEditor.FCKConfig;
     61
     62function doLoadScript(url)
     63{
     64        if (!url)
     65                return false ;
     66
     67        var s = document.createElement('script') ;
     68        s.type = 'text/javascript' ;
     69        s.src = url ;
     70
     71        document.getElementsByTagName('head')[0].appendChild(s) ;
     72
     73        return true ;
     74}
     75
     76function Ok()
     77{
     78        return window.parent.Cancel() ;
     79}
     80
     81function _callOnCancel( dT )
     82{
     83        window.parent.Cancel() ;
     84}
     85
     86function _callOnFinish( dT )
     87{
     88        oEditor.FCK.SetData( dT.value ) ;
     89        window.parent.CloseDialog( true ) ;
     90}
     91
     92function _cancelOnError(m)
     93{
     94        var _conId = 'errorMessage' ;
     95        var message = m || 'Sorry, but service is unavailable now.' ;
     96
     97        if ( typeof( WSC_Error ) == 'undefined' )
     98        {
     99                var _con = document.createElement( 'div' ) ;
     100                _con.setAttribute( 'id', _conId ) ;
     101                document.body.appendChild( _con ) ;
     102                dom_con = document.getElementById( _conId ) ;
     103                dom_con.innerHTML = message ;
     104                dom_con.style.display = 'block' ;
     105        }
     106        //return Ok() ;
     107}
     108
     109function URL_abs2full(uri)
     110{
     111        return uri.match( 'http' )
     112                ? uri
     113                : document.location.protocol + '//' + document.location.host + uri ;
     114}
     115
     116function clearErrorUsermessage()
     117{
     118        // empty error container
     119        var _con = document.getElementById('errorMessage') ;
     120
     121        if ( !_con)
     122                return ;
     123
     124        _con.innerHTML = '' ;
     125        _con.style.display = 'none' ;
     126}
     127
     128var gInterval ;
     129
     130function onLoad()
     131{
     132        clearErrorUsermessage() ;
     133        var _errorMessage = 'The SpellChecker Service is currently unavailable.' ;
     134        if ( 'undefined' != typeof( oEditor.FCK.Config.WSChLoaderScript ) )
     135            _errorMessage = '<div>The SpellChecker Service is currently unavailable.</div><p>Error application loading<br>service host: ' + oEditor.FCK.Config.WSChLoaderScript + '</p>';
     136
     137        var burnSpelling = function( oName, _eMessage )
     138        {
     139                var i = 0 ;
     140
     141                return function ()
     142                {
     143                        if ( typeof( window[oName] ) == 'function' )
     144                                initAndSpell() ;
     145
     146                        if ( i++ == 30 )
     147                                _cancelOnError( _eMessage ) ;
     148                }
     149        }
     150
     151        gInterval = window.setInterval( burnSpelling( 'doSpell', _errorMessage ), 100 ) ;
     152
     153        // WSC CORE init section
     154        var baseUrl = "http://loader.spellchecker.net/sproxy_fck/sproxy.php" ;
     155        var plugin = "fck2" ;
     156        var customerid = oEditor.FCK.Config.WSCnCustomerId
     157                || "1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk" ;
     158        var wscCoreUrl = oEditor.FCK.Config.WSChLoaderScript
     159                || ( baseUrl + '?'
     160                        + 'plugin='    + plugin + '&'
     161                        + 'customerid='+ customerid + '&'
     162                        + 'cmd=script&doc=wsc&schema=22' ) ;
     163
     164        // load WSC core
     165        doLoadScript( wscCoreUrl ) ;
     166}
     167
     168function initAndSpell()
     169{
     170        //xall from window.setInteval expected at once
     171        if (typeof(gInterval) == 'undefined')
     172                return null ;
     173        window.clearInterval( gInterval ) ;
     174
     175        // global var is used in FCK specific core
     176        // change on equal var used in fckplugin.js
     177        gFCKPluginName = 'wsc' ;
     178
     179        // get the data to be checked
     180        var sData = oEditor.FCK.GetData() ;
     181
     182        // prepare content
     183        var ctrlId =  'myEditor' ;
     184        var dCurT = document.getElementById( ctrlId ) ;
     185        dCurT.value = sData ;
     186
     187        // service paths corecting/preparing
     188        var sPath2Scin = URL_abs2full( oEditor.FCK.Config.SkinDialogCSS ) ;
     189        var sPathCiframe = FCKConfig.BasePath + 'wsc/ciframe.html' ;
     190        var sPathFrameset = FCKConfig.BasePath + 'wsc/tmpFrameset.html' ;
     191
     192        // language abbr standarts comparer
     193        var LangComparer = new _SP_FCK_LangCompare() ;
     194        LangComparer.setDefaulLangCode( oEditor.FCK.Language.DefaultLanguage ) ;
     195
     196        // clear user message console (if application was loaded more then after 2 seconds)
     197        clearErrorUsermessage() ;
     198
     199        doSpell({
     200                ctrl : ctrlId,
     201                lang : LangComparer.getSPLangCode( oEditor.FCK.Language.GetActiveLanguage() ),
     202                winType : 'wsc_frames',// if not defined app will run on winpopup
     203
     204                // callback binding section
     205                onCancel :window._callOnCancel,
     206                onFinish :window._callOnFinish,
     207
     208                // @TODO: basePath assingning
     209
     210                // some manipulations with client static pages
     211                framesetPath : sPathFrameset,
     212                iframePath : sPathCiframe,
     213
     214                // styles defining
     215                schemaURI : sPath2Scin
     216        }) ;
     217
     218        return true ;
     219}
     220
     221        </script>
     222</head>
     223<body onload="onLoad()" style="padding: 0px; overflow: hidden;">
     224        <textarea style="display: none;" id="myEditor" rows="10" cols="40"></textarea>
     225        <iframe src="" name="wsc_frames" id="wsc_frames"></iframe>
     226</body>
     227</html>
  • fckconfig.js

     
    160160FCKConfig.StylesXmlPath         = FCKConfig.EditorPath + 'fckstyles.xml' ;
    161161FCKConfig.TemplatesXmlPath      = FCKConfig.EditorPath + 'fcktemplates.xml' ;
    162162
    163 FCKConfig.SpellChecker                  = 'ieSpell' ;   // 'ieSpell' | 'SpellerPages'
     163FCKConfig.SpellChecker                  = 'WSC' ;       // 'WSC' | 'SpellerPages' | 'ieSpell'
    164164FCKConfig.IeSpellDownloadUrl    = 'http://www.iespell.com/download.php' ;
    165165FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ;        // Available extension: .php .cfm .pl
    166166FCKConfig.FirefoxSpellChecker   = false ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy