diff --git a/assets/ckeditor_config_basic.js b/assets/ckeditor_config_speaker_notes.js
similarity index 100%
rename from assets/ckeditor_config_basic.js
rename to assets/ckeditor_config_speaker_notes.js
diff --git a/components/Deck/ContentPanel/SlideModes/SlideEditPanel/SlideContentEditor.js b/components/Deck/ContentPanel/SlideModes/SlideEditPanel/SlideContentEditor.js
index 35e328c0d..328b9de73 100644
--- a/components/Deck/ContentPanel/SlideModes/SlideEditPanel/SlideContentEditor.js
+++ b/components/Deck/ContentPanel/SlideModes/SlideEditPanel/SlideContentEditor.js
@@ -595,7 +595,7 @@ class SlideContentEditor extends React.Component {
this.uniqueIDAllElements();
this.resize();
$('.pptx2html').css({'borderStyle': 'double', 'borderColor': 'rgba(218,102,25,0.5)'});
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
//this.forceUpdate();
}
refreshCKeditor(){
@@ -608,12 +608,31 @@ class SlideContentEditor extends React.Component {
filebrowserUploadUrl: Microservices.import.uri + '/importImage/' + this.props.UserProfileStore.userid,
uploadUrl: Microservices.import.uri + '/importImagePaste/' + this.props.UserProfileStore.userid}); //leave all buttons
+
CKEDITOR.instances.inlineContent.on('instanceReady', (evt) => {
if (this.refs.inlineContent.innerHTML.includes('pptx2html'))
{
+ CKEDITOR.instances.inlineContent.on('afterCommandExec', (evt) => {
+ if(evt.data.name === 'undo') {
+ console.log('undo pressed after refreshing CKeditor');
+ setTimeout(() => {
+ CKEDITOR.instances.inlineContent.fire('lockSnapshot');
+ this.resetResizeDragContext();
+ CKEDITOR.instances.inlineContent.fire('unlockSnapshot');
+ }, 500);
+ }
+ if(evt.data.name === 'redo') {
+ console.log('redo pressed after refreshing CKeditor');
+ setTimeout(() => {
+ CKEDITOR.instances.inlineContent.fire('lockSnapshot');
+ this.resetResizeDragContext();
+ CKEDITOR.instances.inlineContent.fire('unlockSnapshot');
+ }, 500);
+ }
+ });
//this.forceUpdate();
//this.addBorders();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
//ugly fix for SWIK-1218-After using source dialog in CKeditor - input box controls (and template + input box button) do not work
$('.cke_button__sourcedialog_label').mousedown((evt) => { //detect click on source dialog button
//remove resize and drag interaction because it generates HTML in slide editor content
@@ -626,7 +645,7 @@ class SlideContentEditor extends React.Component {
//console.log('====ckeditor save button ok==== - refresh drag and menus');
//this.addBorders();
setTimeout(() => {
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
this.hasChanges = true;
////this.forceUpdate();
}, 500);
@@ -650,7 +669,7 @@ class SlideContentEditor extends React.Component {
//this.addBorders();
setTimeout(() => {
this.refreshCKeditor();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
//this.forceUpdate();
this.hasChanges = true;
}, 500);
@@ -797,6 +816,12 @@ class SlideContentEditor extends React.Component {
$(this).css('box-shadow','');
});
}
+ resetResizeDragContext(){
+ console.log('resetResizeDragContext');
+ this.disableResizeDrag();
+ this.contextMenuAndDragDivAllRemove();
+ this.resizeDragAndContextMenu();
+ }
getHighestZIndex(){
let index_highest = 0;
$('.pptx2html [style*="absolute"]').each(function() {
@@ -839,7 +864,7 @@ class SlideContentEditor extends React.Component {
CKEDITOR.instances.inlineContent.getSelection().unlock();
});
//this.uniqueIDAllElements();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
this.placeCaretAtStart(uniqueID);
$('#' + uniqueID).focus();
@@ -888,7 +913,7 @@ class SlideContentEditor extends React.Component {
//CKEDITOR.instances.inlineContent.setData(newContent);
this.hasChanges = true;
//this.forceUpdate();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
this.resize();
$('.pptx2html').css({'borderStyle': 'double', 'borderColor': 'rgba(218,102,25,0.5)'});
}, (reason) => {
@@ -940,7 +965,7 @@ class SlideContentEditor extends React.Component {
CKEDITOR.disableAutoInline = true;
//if (typeof(CKEDITOR.instances.inlineSpeakerNotes) === 'undefined'){
CKEDITOR.inline('inlineSpeakerNotes', {
- customConfig: '/assets/ckeditor_config_basic.js',
+ customConfig: '/assets/ckeditor_config_speaker_notes.js',
toolbarGroups: [
//needed for Chrome initialization
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] },
@@ -975,7 +1000,24 @@ class SlideContentEditor extends React.Component {
//});
CKEDITOR.instances.inlineContent.on('instanceReady', (evt) => {
-
+ CKEDITOR.instances.inlineContent.on('afterCommandExec', (evt) => {
+ if(evt.data.name === 'undo') {
+ console.log('undo pressed - initial CKeditor load');
+ setTimeout(() => {
+ CKEDITOR.instances.inlineContent.fire('lockSnapshot');
+ this.resetResizeDragContext();
+ CKEDITOR.instances.inlineContent.fire('unlockSnapshot');
+ }, 500);
+ }
+ if(evt.data.name === 'redo') {
+ console.log('redo pressed - initial CKeditor load');
+ setTimeout(() => {
+ CKEDITOR.instances.inlineContent.fire('lockSnapshot');
+ this.resetResizeDragContext();
+ CKEDITOR.instances.inlineContent.fire('unlockSnapshot');
+ }, 500);
+ }
+ });
this.finishLoading = true;
//console.log('test');
CKEDITOR.instances.inlineContent.on( 'key', () => {
@@ -996,9 +1038,9 @@ class SlideContentEditor extends React.Component {
{
//this.forceUpdate();
//this.addBorders();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
- //console.log('resizeDrag and borders');
+ //console.log('resizeDragAndContextMenu and borders');
//show that content is outside of pptx2html box
//$('.pptx2html').css({'borderStyle': 'none none double none', 'borderColor': '#3366ff', 'box-shadow': '0px 100px 1000px #ff8787'});
$('.pptx2html').css({'borderStyle': 'double', 'borderColor': 'rgba(218,102,25,0.5)'});
@@ -1015,7 +1057,7 @@ class SlideContentEditor extends React.Component {
//console.log('====ckeditor save button ok==== - refresh drag and menus');
//this.addBorders();
setTimeout(() => {
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
this.hasChanges = true;
////this.forceUpdate();
}, 500);
@@ -1035,7 +1077,7 @@ class SlideContentEditor extends React.Component {
//this.addBorders();
setTimeout(() => {
this.refreshCKeditor();
- this.resizeDrag();
+ this.resizeDragAndContextMenu();
//this.forceUpdate();
this.hasChanges = true;
}, 500);
@@ -1126,17 +1168,13 @@ class SlideContentEditor extends React.Component {
});
}
- resizeDrag(){
+ resizeDragAndContextMenu(){
//http://jqueryui.com/resizable/
- //http://interface.eyecon.ro/docs/resizable
// TODO -> create SVG around draggable element with points/blocks for resize handlers
// OR by emulating textarea - http://stackoverflow.com/questions/18427555/jquery-textarea-draggable
- // or: make images JQUERY draggable, and have original button for text input - too complex
+ // or: make images JQUERY draggable, and have original button for text input
//