Changeset 30733


Ignore:
Timestamp:
2016-08-22T14:00:04+12:00 (6 years ago)
Author:
kjdon
Message:

modified how the texts are added to the init states. Use ckeditor to add them, otherwise they get added, then ckeditor modifies them, then every section text will appear changed and be sent to setText

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r30703 r30733  
    11531153*    CHANGES SCRIPTS    *
    11541154************************/
     1155
     1156function addCKEEditableState(evt,stateArray)
     1157{
     1158    // Event->Editor->CKE DOM Inline Element that editor was for->underlying jquery element
     1159    element = evt.editor.element.$;
     1160    nodeText = element.innerHTML;
     1161         stateArray.push({
     1162             editableNode : element,
     1163             initHTML : nodeText
     1164         });
     1165   
     1166}
    11551167function addEditableState(editable,stateArray)
    11561168{
     1169
    11571170    if(editable.tagName == 'TEXTAREA')
    11581171    {
    11591172        nodeText = editable.value;
    1160     } 
     1173    }
    11611174    else
    11621175    {
     
    11681181                initHTML : nodeText
    11691182        });
     1183
    11701184}
    11711185
     
    11921206}
    11931207
     1208
    11941209function isNodeChanged(StateToCheck){
    11951210    for (var i in editableInitStates)
    11961211    {
    1197         if ((StateToCheck.editableNode === editableInitStates[i].editableNode) && StateToCheck.initHTML === editableInitStates[i].initHTML )
     1212        if ((StateToCheck.editableNode === editableInitStates[i].editableNode)) {
     1213        if ( StateToCheck.initHTML === editableInitStates[i].initHTML )
    11981214        {
    11991215            return false;
    12001216        }
     1217        return true;
     1218        }
    12011219   
    12021220    }
     
    13051323function readyPageForEditing()
    13061324{
     1325    CKEDITOR.on('instanceReady', function(evt) {
     1326    addCKEEditableState(evt,editableInitStates);
     1327    });
    13071328
    13081329    if($("#metadataSetList").length)
     
    13221343    $("#editContentButton").html("Hide Editor");
    13231344    //wait for 0.5 sec to let ckeditor up
    1324     setTimeout(function(){ $(".sectionText").each(function(){addEditableState(this,editableInitStates);}); }, 500);
    1325 
     1345    //setTimeout(function(){ $(".sectionText").each(function(){addEditableState(this,editableInitStates);}); }, 500);   
    13261346    var editBar = $("#editBarLeft");
    13271347   
Note: See TracChangeset for help on using the changeset viewer.