- Timestamp:
- 2013-03-13T10:43:08+13:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/visual-xml-editor.js
r27055 r27072 340 340 341 341 _toolboxDiv.tabs(); 342 343 customCreateButton.button(); 342 344 } 343 345 … … 420 422 var addToOverList = function(veElement) 421 423 { 424 if(veElement.getDiv().data("toolbar")) 425 { 426 return; 427 } 428 422 429 for(var i = 0; i < _overList.length; i++) 423 430 { … … 562 569 563 570 var _textEditor = $("<div>"); 564 var textTitle = $("<div>Text:</div>");571 var _textTitle = $("<div>Text:</div>"); 565 572 var _nodeText = $("<div>"); 566 573 _nodeText.text(_xmlNode.nodeValue); 567 574 568 _textEditor.append( textTitle);575 _textEditor.append(_textTitle); 569 576 _textEditor.append(_nodeText); 570 577 571 var editButton = $("<button>edit text</button>");572 editButton.click(function()573 { 574 if( editButton.text() == "edit text")578 var _editButton = $("<button>Edit text</button>"); 579 _editButton.click(function() 580 { 581 if(_editButton.button("option", "label") == "Edit text") 575 582 { 576 583 _thisNode.editMode(); … … 581 588 } 582 589 }); 583 _textEditor.append( editButton);590 _textEditor.append(_editButton); 584 591 585 592 this.editMode = function() … … 591 598 _nodeText.text(""); 592 599 _nodeText.append(textArea); 593 editButton.text("done");600 _editButton.button("option", "label", "Done"); 594 601 } 595 602 … … 611 618 _nodeText.empty(); 612 619 _nodeText.text(newValue); 613 editButton.text("edit text");620 _editButton.button("option", "label", "Edit text"); 614 621 } 615 622 616 623 this.getDiv = function() 617 624 { 625 //A hack to make sure the edit text button is styled correctly 626 setTimeout(function(){_editButton.button()}, 1); 618 627 return _textEditor; 619 628 } … … 964 973 _div.data("parentVEElement").setShortName(false); 965 974 } 966 967 _div.data("dragging", false);968 _div.data("toolbar", false);969 975 970 976 _div.css("border", "1px solid black"); … … 972 978 973 979 //If the element was not dropped in a valid place then put it back 974 if(!_validDropSpot )980 if(!_validDropSpot && !_div.data("toolbar")) 975 981 { 976 982 _div.detach(); … … 1015 1021 } 1016 1022 1023 _div.data("dragging", false); 1024 _div.data("toolbar", false); 1025 1017 1026 _overList = new Array(); 1018 1027 _overList.freeSpaces = new Array(); … … 1142 1151 _infoDiv.append(addSelect); 1143 1152 _infoDiv.append(addButton); 1153 addButton.button(); 1144 1154 } 1145 1155 … … 1206 1216 _div.prevBorder = _div.css("border"); 1207 1217 _div.css("border", "red solid 1px"); 1208 1218 1209 1219 _div.data("parentVEElement").focus(); 1210 1220 _div.data("parentVEElement").populateInformationDiv(); … … 1212 1222 event.stopPropagation(); 1213 1223 }); 1224 } 1225 1226 var checkResizeNecessary = function() 1227 { 1228 var elemsToCheck = _div.find(".veTitleElement"); 1229 for(var i = 0; i < elemsToCheck.length; i++) 1230 { 1231 var titleElem = elemsToCheck.eq(i); 1232 titleElem.html("<span>" + titleElem.html() + "</span>"); 1233 var titleSpan = titleElem.children("span"); 1234 1235 var resizeNecessary = false; 1236 if(titleSpan.width() >= titleElem.parent().width()) 1237 { 1238 resizeNecessary = true; 1239 } 1240 titleElem.html(titleSpan.text()); 1241 1242 if(resizeNecessary) 1243 { 1244 return true; 1245 } 1246 } 1247 return false; 1214 1248 } 1215 1249 … … 1244 1278 this.focus = function() 1245 1279 { 1246 _div.data("parentVEElement").expand(); 1247 1248 var parents = _div.parents(".veElement"); 1249 parents.each(function() 1250 { 1251 $(this).data("parentVEElement").expand(); 1252 }); 1280 if(checkResizeNecessary()) 1281 { 1282 _div.data("parentVEElement").expand(); 1283 1284 var parents = _div.parents(".veElement"); 1285 parents.each(function() 1286 { 1287 $(this).data("parentVEElement").expand(); 1288 }); 1289 } 1253 1290 1254 1291 _div.data("parentVEElement").evenlyDistributeChildren();
Note:
See TracChangeset
for help on using the changeset viewer.