mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 13:19:11 +02:00
Side-by-side preview initialisation and navigation fixes.
Disables changetracking on preview options.
This commit is contained in:
parent
4fa2b0f3ff
commit
fa3ef8c126
@ -44,7 +44,7 @@
|
|||||||
* (Object)
|
* (Object)
|
||||||
*/
|
*/
|
||||||
ChangeTrackerOptions: {
|
ChangeTrackerOptions: {
|
||||||
ignoreFieldSelector: '.no-change-track, .ss-upload :input'
|
ignoreFieldSelector: '.no-change-track, .ss-upload :input, .cms-navigator :input'
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,6 @@
|
|||||||
|
|
||||||
// Update preview state selector.
|
// Update preview state selector.
|
||||||
var currentStateName = this.getCurrentStateName();
|
var currentStateName = this.getCurrentStateName();
|
||||||
|
|
||||||
if (currentStateName) {
|
if (currentStateName) {
|
||||||
this.find('.cms-preview-states').changeVisibleState(currentStateName);
|
this.find('.cms-preview-states').changeVisibleState(currentStateName);
|
||||||
}
|
}
|
||||||
@ -133,9 +132,10 @@
|
|||||||
* Enable the area and start updating to reflect the content editing.
|
* Enable the area and start updating to reflect the content editing.
|
||||||
*/
|
*/
|
||||||
enablePreview: function() {
|
enablePreview: function() {
|
||||||
|
if (!this.getIsPreviewEnabled()) {
|
||||||
this.setIsPreviewEnabled(true);
|
this.setIsPreviewEnabled(true);
|
||||||
this.changeMode('split');
|
this.changeMode('split');
|
||||||
this._loadCurrentState();
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -190,6 +190,8 @@
|
|||||||
} else {
|
} else {
|
||||||
this.enablePreview();
|
this.enablePreview();
|
||||||
this._moveNavigator();
|
this._moveNavigator();
|
||||||
|
this._loadCurrentState();
|
||||||
|
this.redraw();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
@ -285,7 +287,6 @@
|
|||||||
if (navigatorEl.length && previewEl.length) {
|
if (navigatorEl.length && previewEl.length) {
|
||||||
// Navigator is available - install the navigator.
|
// Navigator is available - install the navigator.
|
||||||
previewEl.html($('.cms-edit-form .cms-navigator').detach());
|
previewEl.html($('.cms-edit-form .cms-navigator').detach());
|
||||||
$('.cms-preview')._loadCurrentState();
|
|
||||||
} else {
|
} else {
|
||||||
// Navigator not available.
|
// Navigator not available.
|
||||||
this._block();
|
this._block();
|
||||||
@ -375,19 +376,13 @@
|
|||||||
* Change the appearance of the state selector.
|
* Change the appearance of the state selector.
|
||||||
*/
|
*/
|
||||||
changeVisibleState: function(state) {
|
changeVisibleState: function(state) {
|
||||||
// Arbitrary mapping from checkbox state to the preview state.
|
this.find('input[data-name="'+state+'"]').prop('checked', true);
|
||||||
if (state==='LiveLink') {
|
|
||||||
this.find('.cms-preview-checkbox').prop('checked', false);
|
|
||||||
} else {
|
|
||||||
this.find('.cms-preview-checkbox').prop('checked', true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.cms-preview-states .state-name').entwine({
|
$('.cms-preview-states .state-name').entwine({
|
||||||
/**
|
/**
|
||||||
* Reacts to the user changing the state of the preview.
|
* Reacts to the user changing the state of the preview.
|
||||||
* TODO Rewrite this function to ensure we can handle 1,2,3+ states.
|
|
||||||
*/
|
*/
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
var targetStateName = $(this).attr('data-name');
|
var targetStateName = $(this).attr('data-name');
|
||||||
|
Loading…
Reference in New Issue
Block a user