Radu
Radu

Reputation: 1066

Sitecore cannot save in Experience Editor special characters

The website is component bases website. In a component I have rich-text and inside of that I have something like 70%. After I add the component to the page the save on the page does not work anymore.

Does someone had an issue like this before?

Upvotes: 1

Views: 1088

Answers (4)

Rob Scott
Rob Scott

Reputation: 8049

This post fixed for me. Note I'm using Sitecore 8.2 Update 2

My error:

After parsing a value an unexpected character was encountered: {. Path 'scLayout', line 1, position 2246.

http://jockstothecore.com/experience-editor-error/

postServerRequest: function (requestType, commandContext, handler, async) {

    function normalizeDeviceProp(d) {
        if (typeof(d) !== "object")
            throw new Error("Unexpected presentation details XML: cannot find device property");

        if (d instanceof Array)
            return d;

        var normalized = [];
        normalized.push(d);
        return normalized;
    }

    var token = $('input[name="__RequestVerificationToken"]').val();

    // Custom Brainjocks code to fix Experience Editor error.
    var ajaxData = unescape(JSON.stringify(commandContext));
    if (commandContext && commandContext.scLayout) {
        var obj = JSON.parse(commandContext.scLayout);
      if (obj && obj.r) {
          normalizeDeviceProp(obj.r.d).forEach(function (d) {
              if (d.r instanceof Array) {
                  d.r.forEach(function (r) {
                      var val = r["@par"];
                        if (val && val.length > 0) {
                            ajaxData = ajaxData.replace(unescape(val), val);
                        }
                  });
              }

            });
        }
    }

    jQuery.ajax({
        url: "/-/speak/request/v1/expeditor/" + requestType,
        data: {
            __RequestVerificationToken: token,
            data: ajaxData
        },
        success: handler,
        type: "POST",
        async: async != undefined ? async : false
    });
}

Upvotes: 0

Vlad Iobagiu
Vlad Iobagiu

Reputation: 4118

Looks like also other had same issue :

1) Replace the /sitecore/shell/client/Sitecore/ExperienceEditor/ExperienceEditor.js file of your environment with https://www.dropbox.com/s/fk5dhzywuln19t7/ExperienceEditor.js?dl=0

2) Replace the /sitecore/shell/client/Sitecore/ExperienceEditor/RibbonPageCode.js file of your environment with https://www.dropbox.com/s/vk0owx9gmihpgf0/RibbonPageCode.js?dl=0

3) Clear your browser cache.

Original post was here: https://community.sitecore.net/developers/f/8/t/2536

Upvotes: 2

jammykam
jammykam

Reputation: 17000

This is a known issue, contact Sitecore Support and they will be able to provide a fix, reference 84051.

The fix is to edit a couple of Javascript files. In Sitecore 8.0 update-6:

/sitecore/shell/client/Sitecore/ExperienceEditor/RibbonPageCode.js

In the initialized function

replace ribbonUrl: this.PageEditBar.get("url")

with ribbonUrl: decodeURIComponent(this.PageEditBar.get("url"))

/sitecore/shell/client/Sitecore/ExperienceEditor/Sitecore.ExperienceEditor.js

In the postServerRequest function

replace data: decodeURIComponent(decodeURIComponent(JSON.stringify(commandContext)))

with data: decodeURIComponent(JSON.stringify(commandContext))

Upvotes: 4

Brett
Brett

Reputation: 897

That sounds like an issue we experienced early this year, but the issue we had was fixed in Sitecore 8.1 Update 2. The public reference number was 84051.

Upvotes: 1

Related Questions