Update to latest pullbox branch

Noticable changes:
* focus returns to canvas after paragraph style selection
pull/1/head
Friedrich W. H. Kossebau 11 years ago
parent 70ad7f824b
commit ff5c0ec6ff

@ -17,7 +17,7 @@ html, body, #mainContainer {
#editor {
border: none;
box-shadow: 0px 0px 14px black;
box-shadow: 0px 0px 14px #555;
overflow: hidden;
padding: 0px !important;
z-index: 4;
@ -29,8 +29,9 @@ html, body, #mainContainer {
#container {
text-align: center;
background-color: #FAFAFA;
background-color: #ddd;
overflow: auto;
position: absolute;
top: 30px;
bottom: 0;

@ -172,16 +172,11 @@
padding-top: 3em !important;
}
#editor {
box-shadow: 0px 0px 14px #555 !important;
}
#toolbar {
border-bottom: none !important;
padding: 6px 0 !important;
}
#container {
background-color: #ddd !important;
top: 38px !important;
}

@ -285,6 +285,12 @@ define("webodf/editor/Editor", [
});
};
function setFocusToOdfCanvas() {
if (odfCanvas) {
odfCanvas.getElement().focus();
}
}
// init
function init() {
var editorPane, memberListPane,
@ -363,6 +369,7 @@ define("webodf/editor/Editor", [
}
tools = new Tools({
onToolDone: setFocusToOdfCanvas,
loadOdtFile: loadOdtFile,
saveOdtFile: saveOdtFile,
close: close,

@ -114,11 +114,6 @@ define("webodf/editor/MemberListView",
}
};
memberListDiv.appendChild(avatarDiv);
// preset bogus data
// TODO: indicate loading state
// (instead of setting the final 'unknown identity' data)
updateAvatarButton(memberId, null);
}
/**

@ -52,6 +52,7 @@ define("webodf/editor/Tools", [
return function Tools(args) {
var translator = document.translator,
onToolDone = args.onToolDone,
loadOdtFile = args.loadOdtFile,
saveOdtFile = args.saveOdtFile,
close = args.close,
@ -106,6 +107,7 @@ define("webodf/editor/Tools", [
onClick: function () {
if (editorSession) {
editorSession.addAnnotation();
onToolDone();
}
}
});
@ -114,7 +116,7 @@ define("webodf/editor/Tools", [
// Simple Style Selector [B, I, U, S]
if (args.directStylingEnabled) {
simpleStyles = new SimpleStyles(function (widget) {
simpleStyles = new SimpleStyles(onToolDone, function (widget) {
widget.placeAt(toolbar);
widget.startup();
});
@ -123,7 +125,7 @@ define("webodf/editor/Tools", [
// Paragraph direct alignment buttons
if (args.directStylingEnabled) {
paragraphAlignment = new ParagraphAlignment(function (widget) {
paragraphAlignment = new ParagraphAlignment(onToolDone, function (widget) {
widget.placeAt(toolbar);
widget.startup();
});
@ -132,7 +134,7 @@ define("webodf/editor/Tools", [
// Paragraph Style Selector
currentStyle = new CurrentStyle(function (widget) {
currentStyle = new CurrentStyle(onToolDone, function (widget) {
widget.placeAt(toolbar);
widget.startup();
});

@ -42,7 +42,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
function (ToggleButton, Button) {
"use strict";
var ParagraphAlignment = function (callback) {
var ParagraphAlignment = function (onToolDone, callback) {
var widget = {},
directParagraphStyler,
justifyLeft,
@ -60,6 +60,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconJustifyLeft",
onChange: function () {
directParagraphStyler.alignParagraphLeft();
onToolDone();
}
});
@ -71,6 +72,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconJustifyCenter",
onChange: function () {
directParagraphStyler.alignParagraphCenter();
onToolDone();
}
});
@ -82,6 +84,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconJustifyRight",
onChange: function () {
directParagraphStyler.alignParagraphRight();
onToolDone();
}
});
@ -93,6 +96,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconJustifyFull",
onChange: function () {
directParagraphStyler.alignParagraphJustified();
onToolDone();
}
});
@ -103,6 +107,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconOutdent",
onClick: function () {
directParagraphStyler.outdent();
onToolDone();
}
});
@ -113,6 +118,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
iconClass: "dijitEditorIcon dijitEditorIconIndent",
onClick: function () {
directParagraphStyler.indent();
onToolDone();
}
});

@ -43,7 +43,7 @@ define("webodf/editor/widgets/simpleStyles", [
function (FontPicker, ToggleButton, NumberSpinner) {
"use strict";
var SimpleStyles = function(callback) {
var SimpleStyles = function(onToolDone, callback) {
var widget = {},
directTextStyler,
boldButton,
@ -62,6 +62,7 @@ define("webodf/editor/widgets/simpleStyles", [
iconClass: "dijitEditorIcon dijitEditorIconBold",
onChange: function (checked) {
directTextStyler.setBold(checked);
onToolDone();
}
});
@ -73,6 +74,7 @@ define("webodf/editor/widgets/simpleStyles", [
iconClass: "dijitEditorIcon dijitEditorIconItalic",
onChange: function (checked) {
directTextStyler.setItalic(checked);
onToolDone();
}
});
@ -84,6 +86,7 @@ define("webodf/editor/widgets/simpleStyles", [
iconClass: "dijitEditorIcon dijitEditorIconUnderline",
onChange: function (checked) {
directTextStyler.setHasUnderline(checked);
onToolDone();
}
});
@ -95,6 +98,7 @@ define("webodf/editor/widgets/simpleStyles", [
iconClass: "dijitEditorIcon dijitEditorIconStrikethrough",
onChange: function (checked) {
directTextStyler.setHasStrikethrough(checked);
onToolDone();
}
});
@ -116,6 +120,7 @@ define("webodf/editor/widgets/simpleStyles", [
fontPickerWidget.setAttribute('disabled', true);
fontPickerWidget.onChange = function(value) {
directTextStyler.setFontName(value);
onToolDone();
};
widget.children = [boldButton, italicButton, underlineButton, strikethroughButton, fontPickerWidget, fontSizeSpinner];

@ -41,7 +41,7 @@ define("webodf/editor/widgets/toolbarWidgets/currentStyle",
function (EditorSession) {
"use strict";
return function CurrentStyle(callback) {
return function CurrentStyle(onToolDone, callback) {
var editorSession,
paragraphStyles;
@ -56,6 +56,7 @@ define("webodf/editor/widgets/toolbarWidgets/currentStyle",
function setParagraphStyle(value) {
if (editorSession) {
editorSession.setCurrentParagraphStyle(value);
onToolDone();
}
}

@ -2993,12 +2993,12 @@ core.Utils = function Utils() {
}
this.hashString = hashString;
function mergeObjects(destination, source) {
if(Array.isArray(source)) {
if(source && Array.isArray(source)) {
destination = (destination || []).concat(source.map(function(obj) {
return mergeObjects({}, obj)
}))
}else {
if(typeof source === "object") {
if(source && typeof source === "object") {
destination = destination || {};
Object.keys(source).forEach(function(p) {
destination[p] = mergeObjects(destination[p], source[p])
@ -3340,6 +3340,17 @@ core.UnitTest.cleanupTestAreaDiv = function() {
runtime.assert(!!testarea && testarea.parentNode === maindoc.body, 'Test environment broken, found no div with id "testarea" below body.');
maindoc.body.removeChild(testarea)
};
core.UnitTest.createOdtDocument = function(xml, namespaceMap) {
var xmlDoc = "<?xml version='1.0' encoding='UTF-8'?>";
xmlDoc += "<office:document";
Object.keys(namespaceMap).forEach(function(key) {
xmlDoc += " xmlns:" + key + '="' + namespaceMap[key] + '"'
});
xmlDoc += ">";
xmlDoc += xml;
xmlDoc += "</office:document>";
return runtime.parseXML(xmlDoc)
};
core.UnitTestRunner = function UnitTestRunner() {
var failedTests = 0, areObjectsEqual;
function debug(msg) {
@ -9435,10 +9446,12 @@ odf.OdfCanvas = function() {
};
this.destroy = function(callback) {
var head = doc.getElementsByTagName("head")[0];
if(annotationsPane.parentNode) {
if(annotationsPane && annotationsPane.parentNode) {
annotationsPane.parentNode.removeChild(annotationsPane)
}
element.removeChild(sizer);
if(sizer) {
element.removeChild(sizer)
}
head.removeChild(webodfcss);
head.removeChild(fontcss);
head.removeChild(stylesxmlcss);
@ -11751,23 +11764,23 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) {
}
return comparison
}
function countStepsToPosition(posElement, posOffset, filter) {
runtime.assert(posElement !== null, "SelectionMover.countStepsToPosition called with element===null");
function countStepsToPosition(targetNode, targetOffset, filter) {
runtime.assert(targetNode !== null, "SelectionMover.countStepsToPosition called with element===null");
var iterator = getIteratorAtCursor(), c = iterator.container(), o = iterator.unfilteredDomOffset(), steps = 0, watch = new core.LoopWatchDog(1E3), comparison;
iterator.setUnfilteredPosition(posElement, posOffset);
posElement = (iterator.container());
runtime.assert(Boolean(posElement), "SelectionMover.countStepsToPosition: positionIterator.container() returned null");
posOffset = iterator.unfilteredDomOffset();
iterator.setUnfilteredPosition(targetNode, targetOffset);
targetNode = iterator.container();
runtime.assert(Boolean(targetNode), "SelectionMover.countStepsToPosition: positionIterator.container() returned null");
targetOffset = iterator.unfilteredDomOffset();
iterator.setUnfilteredPosition(c, o);
comparison = comparePoints(posElement, posOffset, iterator.container(), iterator.unfilteredDomOffset());
comparison = comparePoints(targetNode, targetOffset, iterator.container(), iterator.unfilteredDomOffset());
if(comparison < 0) {
while(iterator.nextPosition()) {
watch.check();
if(filter.acceptPosition(iterator) === FILTER_ACCEPT) {
steps += 1
}
if(iterator.container() === posElement) {
if(iterator.unfilteredDomOffset() === posOffset) {
if(iterator.container() === targetNode) {
if(iterator.unfilteredDomOffset() === targetOffset) {
return steps
}
}
@ -11777,11 +11790,9 @@ gui.SelectionMover = function SelectionMover(cursor, rootNode) {
while(iterator.previousPosition()) {
watch.check();
if(filter.acceptPosition(iterator) === FILTER_ACCEPT) {
steps -= 1
}
if(iterator.container() === posElement) {
if(iterator.unfilteredDomOffset() === posOffset) {
return steps
steps -= 1;
if(comparePoints(targetNode, targetOffset, iterator.container(), iterator.unfilteredDomOffset()) <= 0) {
break
}
}
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save