Sitecore 无法在体验编辑器中保存特殊字符

Sitecore cannot save in Experience Editor special characters

本站为组件式网站。在一个组件中,我有富文本,在其中我有大约 70% 的内容。将组件添加到页面后,页面上的保存不再起作用。

以前有人遇到过这样的问题吗?

看起来其他人也有同样的问题:

1) 将环境的/sitecore/shell/client/Sitecore/ExperienceEditor/ExperienceEditor.js文件替换为https://www.dropbox.com/s/fk5dhzywuln19t7/ExperienceEditor.js?dl=0

2) 将环境的/sitecore/shell/client/Sitecore/ExperienceEditor/RibbonPageCode.js文件替换为https://www.dropbox.com/s/vk0owx9gmihpgf0/RibbonPageCode.js?dl=0

3) 清除浏览器缓存。

原 post 在这里:https://community.sitecore.net/developers/f/8/t/2536

这听起来像是我们今年年初遇到的问题,但我们已经在 Sitecore 8.1 Update 2 中解决了这个问题。 public 参考编号为 84051。

这是一个已知问题,请联系 Sitecore 支持,他们将能够提供修复,参考号 84051。

修复是edit a couple of Javascript files。在 Sitecore 8.0 update-6 中:

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

initialized函数中

替换ribbonUrl: this.PageEditBar.get("url")

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

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

postServerRequest函数中

替换data: decodeURIComponent(decodeURIComponent(JSON.stringify(commandContext)))

data: decodeURIComponent(JSON.stringify(commandContext))

这个 post 为我修复了。 请注意,我使用的是 Sitecore 8.2 更新 2

我的错误:

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
    });
}