lib/assets/javascripts/scrivito.js in scrivito_sdk-1.10.0 vs lib/assets/javascripts/scrivito.js in scrivito_sdk-1.11.0.rc1
- old
+ new
@@ -61,54 +61,55 @@
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 848);
+/******/ return __webpack_require__(__webpack_require__.s = 1143);
/******/ })
/************************************************************************/
/******/ ({
-/***/ 57:
+/***/ 1143:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-(function () {
- var scrivitoUi = void 0;
+var _install_rails_api_fallback = __webpack_require__(213);
- if (window.parent !== window) {
- scrivitoUi = window.parent.scrivito;
- if (scrivitoUi) {
- // In an iframe and parent window contains the UI: in UI mode.
- var cmsDocument = scrivitoUi.cms_element.from_dom_element(document);
- cmsDocument.installPublicApi();
- cmsDocument.addAppExtensions();
+var _install_rails_api_fallback2 = _interopRequireDefault(_install_rails_api_fallback);
- if (window.scrivito.AppAdapter) {
- cmsDocument.setAppAdapter(window.scrivito.AppAdapter);
- }
+var _connect_to_ui = __webpack_require__(79);
- // wait for app to be fully loaded
- document.addEventListener('DOMContentLoaded', function () {
- // wait for UI to be fully loaded
- scrivitoUi.on('load', function () {
- cmsDocument.assertUserLoggedIn();
- cmsDocument.connect();
- });
- });
- }
- }
+var _connect_to_ui2 = _interopRequireDefault(_connect_to_ui);
- if (window.scrivito && window.scrivito.client) {
- scrivito.client.init({ scrivitoUi: scrivitoUi, realmContext: window.scrivito });
- document.addEventListener('DOMContentLoaded', function () {
- return scrivito.BrowserLocation.init();
- });
- }
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+/*
+ * This is the webpack entry file used by Rails-only application (without JS SDK)
+ */
+var ui = (0, _connect_to_ui2.default)();
+
+if (ui) {
+ ui.installRailsApi();
+} else {
+ (0, _install_rails_api_fallback2.default)();
+}
+
+/***/ }),
+
+/***/ 213:
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = installRailsApiFallback;
+function installRailsApiFallback() {
// If the SDK is completely missing, the custom callbacks should nevertheless run.
if (!window.scrivito) {
window.scrivito = {};
}
@@ -125,20 +126,36 @@
if (!window.scrivito.in_editable_view) {
window.scrivito.in_editable_view = function () {
return false;
};
}
-})();
+}
/***/ }),
-/***/ 848:
+/***/ 79:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-__webpack_require__(57);
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = connectToUi;
+// checks whether the UI is present
+// if so, returns an instance of UiConnection
+function connectToUi() {
+ // check if there's a parent frame
+ if (window.parent === window) {
+ return;
+ }
+
+ var connectAppDocument = window.parent.connectAppDocument;
+ if (connectAppDocument) {
+ return connectAppDocument(window.document);
+ }
+}
/***/ })
/******/ });
\ No newline at end of file