Opened 9 years ago

Closed 9 years ago

#14597 closed Bug (invalid)

After enabling scayt in inline mode and click browser back button gives error.

Reported by: Chidanand Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Steps to reproduce

  1. I have multiple CKEditor inline instances on a single page.
  2. Click on any inline editor will display CKEditor toolbar.
  3. From toolbar select SCAYT drop-down and click "Enable SCAYT".
  4. On right click of wrong word gives you spell check suggestion select any one from the list.
  5. Now click on browser back button gives error.

Expected result

1.Should not give any error after browser back button click.

2.This gives error only when we "Enable SCAYT", in all other case it working as expected.

Actual result

Gives following error :

Mismatched anonymous define() module: function(a) {
    return a.createModule("SaveRestore", ["WrappedSelection"], function(a, b) {
        function c(a, b) {
            return (b || document).getElementById(a)
        }

        function d(a, b) {
            var c, d = "selectionBoundary_" + +new Date + "_" + ("" + Math.random()).slice(2),
                e = o.getDocument(a.startContainer),
                f = a.cloneRange();
            return f.collapse(b), c = e.createElement("span"), c.id = d, c.style.lineHeight = "0", c.style.display = "none", c.className = "rangySelectionBoundary", c.appendChild(e.createTextNode(r)), f.insertNode(c), c
        }

        function e(a, d, e, f) {
            var g = c(e, a);
            g ? (d[f ? "setStartBefore" : "setEndBefore"](g), p(g)) : b.warn("Marker element has been removed. Cannot restore selection.")
        }

        function f(a, b) {
            return b.compareBoundaryPoints(a.START_TO_START, a)
        }

        function g(b, c) {
            var e, f, g = a.DomRange.getRangeDocument(b),
                h = b.toString(),
                i = q(c);
            return b.collapsed ? (f = d(b, !1), {
                document: g,
                markerId: f.id,
                collapsed: !0	
            }) : (f = d(b, !1), e = d(b, !0), {
                document: g,
                startMarkerId: e.id,
                endMarkerId: f.id,
                collapsed: !1,
                backward: i,
                toString: function() {
                    return "original text: '" + h + "', new text: '" + b.toString() + "'"
                }
            })
        }

        function h(d, f) {
            var g = d.document;
            "undefined" == typeof f && (f = !0);
            var h = a.createRange(g);
            if (d.collapsed) {
                var i = c(d.markerId, g);
                if (i) {
                    i.style.display = "inline";
                    var j = i.previousSibling;
                    j && 3 == j.nodeType ? (p(i), h.collapseToPoint(j, j.length)) : (h.collapseBefore(i), p(i))
                } else b.warn("Marker element has been removed. Cannot restore selection.")
            } else e(g, h, d.startMarkerId, !0), e(g, h, d.endMarkerId, !1);
            return f && h.normalizeBoundaries(), h
        }

        function i(b, d) {
            var e, h, i = [],
                j = q(d);
            b = b.slice(0), b.sort(f);
            for (var k = 0, l = b.length; l > k; ++k) i[k] = g(b[k], j);
            for (k = l - 1; k >= 0; --k) e = b[k], h = a.DomRange.getRangeDocument(e), e.collapsed ? e.collapseAfter(c(i[k].markerId, h)) : (e.setEndBefore(c(i[k].endMarkerId, h)), e.setStartAfter(c(i[k].startMarkerId, h)));
            return i
        }

        function j(c) {
            if (!a.isSelectionValid(c)) return b.warn("		."), null;↵
            var d = a.getSelection(c),
                e = d.getAllRanges(),
                f = 1 == e.length && d.isBackward(),
                g = i(e, f);
            return f ? d.setSingleRange(e[0], f) : d.setRanges(e), {
                win: c,
                rangeInfos: g,
                restored: !1
            }
        }

        function k(a) {
            for (var b = [], c = a.length, d = c - 1; d >= 0; d--) b[d] = h(a[d], !0);
            return b
        }

        function l(b, c) {
            if (!b.restored) {
                var d = b.rangeInfos,
                    e = a.getSelection(b.win),
                    f = k(d),
                    g = d.length;
                1 == g && c && a.features.selectionHasExtend && d[0].backward ? (e.removeAllRanges(), e.addRange(f[0], !0)) : e.setRanges(f), b.restored = !0
            }
        }

        function m(a, b) {
            var d = c(b, a);
            d && p(d)
        }

        function n(a) {
            for (var b, c = a.rangeInfos, d = 0, e = c.length; e > d; ++d) b = c[d], b.collapsed ? m(a.doc, b.markerId) : (m(a.doc, b.startMarkerId), m(a.doc, b.endMarkerId))
        }
        var o = a.dom,
            p = o.removeNode,
            q = a.Selection.isDirectionBackward,
            r = "";
        a.util.extend(a, {
            saveRange: g,
            restoreRange: h,
            saveRanges: i,
            restoreRanges: k,
            saveSelection: j,
            restoreSelection: l,
            removeMarkerElement: m,
            removeMarkers: n
        })
    }), a
}

Other details (browser, OS, CKEditor version, installed plugins)

Browser - Google Chrome - Version 49.0.2623.112.

OS - Windows 8.1

CKEditor version - 4.5.8 (Full)

Installed plugins - dragresize, imageresize, placeholder (does not cause any issue with extra plugins).

Change History (6)

comment:1 Changed 9 years ago by Jakub Ś

Status: newpending
Version: 4.5.8

I have downloaded CKEditor 4.5.8 full package, opened ckeditor/samples/old/inlineall.html sample, I have followed your steps but no error was thrown. I have tried browser back button and CKEditor undo button.

Are you able to reproduce this issue with standalone CKEditor and not integrated into your application?


Please make sure that you don't have any third-party chrome plugins installed as they are known to conflict with JS applications.


SCAYT is CKEditor add-on maintained by another company. Normally we report such issues to scayt team - https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues but since I'm not able to reproduce this problem with default CKEditor package, currently I will not do that.


@Chidanand please try standalone CKEditor and if I have missed anything in my steps, please let me know.

comment:2 Changed 9 years ago by Chidanand

Thank you for reply..

It's working perfect in previous version (i.e CKEditor 4.5.7 full) without any error. After some time it is throwing run time error (in the same version- 4.5.7) from JavaScript file http://svc.webspellchecker.net/spellcheck31/lf/scayt3/ckscayt/ckscayt.js .

After some analysis we found that b.Lib is as 'undefined' at b.Lib.init() as we can see ckscayt.js code

b.RangyAdapter=function(a,c,d,e) 
{
var f=SCAYT.prototype.UILib;b.Lib=b.Lib||SCAYT.rangy||window.rangy,b.Lib.initialized===!1&&b.Lib.init();

To resolve above error i have updated CKEditor version i.e CKEditor 4.5.8 full from NuGet package and it solves above error, but now it is throwing another error as mention above "Actual result" block.

please update me if you find any solution.

Thank you.

comment:3 Changed 9 years ago by Jakub Ś

please update me if you find any solution.

As I have mentioned before. If error gets thrown in one of scayt file then there is nothing we can do here.

Such error needs to be reported to SCAYT team but in order to do that, clear reproduction steps are needed. You have to be able to reproduce this issue in standalone CKEditor used together with SCAYT plugin. Problem should be reproducible outside of your application in order to exclude its influence.

I haven't been able to reproduce this problem in clean CKEditor+SCAYT. Are you able to provide such steps or screen-cast showing how it can be done (on CKEditor demo page for example)?

comment:4 Changed 9 years ago by Dragos-Constantin Dumitriu

Hi,

We have the same problem on the application now since the SCAYT plugin update, I have to mention that we use RequireJS (http://requirejs.org/docs/errors.html#mismatch). I checked the SCAYT plugin source and I saw that some AMD support has been added recently, and I think that may be the cause of this.

This may be the cause:

function(a, b) {

"function" == typeof define && define.amd ? define(rangy-core?, a) : "undefined" != typeof module && "object" == typeof exports ? module.exports = a(require("rangy")) : a(b.rangy)

}

comment:5 Changed 9 years ago by Chidanand

Hi,

Thank you for the update.

Is there any workaround for the same? or please let us know if you find any solution.

Thank you again.

comment:6 Changed 9 years ago by Jakub Ś

Resolution: invalid
Status: pendingclosed

@dragoscd this issue should be reported to SCAYT team and not the CKSource provided that you can provide clean reproduction steps.

@Chidanand please read my last comment - there is no workaround, CKSource can provide. I'm closing this ticket as invalid.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy