tiny webodf updates
This commit is contained in:
parent
7359811f1e
commit
2130c872a8
@ -169,6 +169,7 @@ define("webodf/editor/Editor", [
|
|||||||
editorSession = new EditorSession(session, memberid, {
|
editorSession = new EditorSession(session, memberid, {
|
||||||
viewOptions: viewOptions
|
viewOptions: viewOptions
|
||||||
});
|
});
|
||||||
|
editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager());
|
||||||
|
|
||||||
if (peopleListDiv) {
|
if (peopleListDiv) {
|
||||||
userList = new UserList(editorSession, peopleListDiv);
|
userList = new UserList(editorSession, peopleListDiv);
|
||||||
@ -218,7 +219,7 @@ define("webodf/editor/Editor", [
|
|||||||
* call editorReadyCallback once everything is done.
|
* call editorReadyCallback once everything is done.
|
||||||
*
|
*
|
||||||
* @param {!string} docUrl
|
* @param {!string} docUrl
|
||||||
* @param {?function()} editorReadyCallback
|
* @param {!function()} editorReadyCallback
|
||||||
* @return {undefined}
|
* @return {undefined}
|
||||||
*/
|
*/
|
||||||
self.initAndLoadDocument = function (docUrl, editorReadyCallback) {
|
self.initAndLoadDocument = function (docUrl, editorReadyCallback) {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
* @source: http://www.webodf.org/
|
* @source: http://www.webodf.org/
|
||||||
* @source: http://gitorious.org/webodf/webodf/
|
* @source: http://gitorious.org/webodf/webodf/
|
||||||
*/
|
*/
|
||||||
/*global define,runtime,gui,ops,document */
|
/*global define, runtime, core, gui, ops, document */
|
||||||
define("webodf/editor/EditorSession", [
|
define("webodf/editor/EditorSession", [
|
||||||
"dojo/text!resources/fonts/fonts.css"
|
"dojo/text!resources/fonts/fonts.css"
|
||||||
], function (fontsCSS) { // fontsCSS is retrieved as a string, using dojo's text retrieval AMD plugin
|
], function (fontsCSS) { // fontsCSS is retrieved as a string, using dojo's text retrieval AMD plugin
|
||||||
@ -136,10 +136,11 @@ define("webodf/editor/EditorSession", [
|
|||||||
*/
|
*/
|
||||||
function createNCName(name) {
|
function createNCName(name) {
|
||||||
var letter,
|
var letter,
|
||||||
result = "";
|
result = "",
|
||||||
|
i;
|
||||||
|
|
||||||
// encode
|
// encode
|
||||||
for (var i = 0; i < name.length; i++) {
|
for (i = 0; i < name.length; i++) {
|
||||||
letter = name[i];
|
letter = name[i];
|
||||||
// simple approach, can be improved to not skip other allowed chars
|
// simple approach, can be improved to not skip other allowed chars
|
||||||
if (letter.match(/[a-zA-Z0-9.-_]/) !== null) {
|
if (letter.match(/[a-zA-Z0-9.-_]/) !== null) {
|
||||||
@ -166,7 +167,7 @@ define("webodf/editor/EditorSession", [
|
|||||||
// memberid is used to avoid id conflicts with ids created by other users
|
// memberid is used to avoid id conflicts with ids created by other users
|
||||||
result = ncName + "_" + ncMemberId;
|
result = ncName + "_" + ncMemberId;
|
||||||
// then loop until result is really unique
|
// then loop until result is really unique
|
||||||
while(formatting.hasParagraphStyle(result)) {
|
while (formatting.hasParagraphStyle(result)) {
|
||||||
result = ncName + "_" + i + "_" + ncMemberId;
|
result = ncName + "_" + i + "_" + ncMemberId;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -261,7 +262,7 @@ define("webodf/editor/EditorSession", [
|
|||||||
return odtDocument.getCursorPosition(memberid);
|
return odtDocument.getCursorPosition(memberid);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getCursorSelection = function() {
|
this.getCursorSelection = function () {
|
||||||
return odtDocument.getCursorSelection(memberid);
|
return odtDocument.getCursorSelection(memberid);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -277,7 +278,7 @@ define("webodf/editor/EditorSession", [
|
|||||||
return formatting.getAvailableParagraphStyles();
|
return formatting.getAvailableParagraphStyles();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getCurrentSelectionStyle = function() {
|
this.getCurrentSelectionStyle = function () {
|
||||||
var cursor = odtDocument.getCursor(memberid),
|
var cursor = odtDocument.getCursor(memberid),
|
||||||
selectedRange;
|
selectedRange;
|
||||||
// no own cursor yet/currently added?
|
// no own cursor yet/currently added?
|
||||||
@ -295,7 +296,7 @@ define("webodf/editor/EditorSession", [
|
|||||||
return currentNamedStyleName;
|
return currentNamedStyleName;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.formatSelection = function(value) {
|
this.formatSelection = function (value) {
|
||||||
var op = new ops.OpApplyStyle(),
|
var op = new ops.OpApplyStyle(),
|
||||||
selection = self.getCursorSelection();
|
selection = self.getCursorSelection();
|
||||||
op.init({
|
op.init({
|
||||||
@ -320,7 +321,7 @@ define("webodf/editor/EditorSession", [
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.insertTable = function(initialRows, initialColumns, tableStyleName, tableColumnStyleName, tableCellStyleMatrix) {
|
this.insertTable = function (initialRows, initialColumns, tableStyleName, tableColumnStyleName, tableCellStyleMatrix) {
|
||||||
var op = new ops.OpInsertTable();
|
var op = new ops.OpInsertTable();
|
||||||
op.init({
|
op.init({
|
||||||
memberid: memberid,
|
memberid: memberid,
|
||||||
@ -450,16 +451,16 @@ define("webodf/editor/EditorSession", [
|
|||||||
self.emit(EditorSession.signalUndoStackChanged, e);
|
self.emit(EditorSession.signalUndoStackChanged, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasUndoManager = function() {
|
this.hasUndoManager = function () {
|
||||||
return Boolean(self.sessionController.getUndoManager());
|
return Boolean(self.sessionController.getUndoManager());
|
||||||
};
|
};
|
||||||
|
|
||||||
this.undo = function() {
|
this.undo = function () {
|
||||||
var undoManager = self.sessionController.getUndoManager();
|
var undoManager = self.sessionController.getUndoManager();
|
||||||
undoManager.moveBackward(1);
|
undoManager.moveBackward(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.redo = function() {
|
this.redo = function () {
|
||||||
var undoManager = self.sessionController.getUndoManager();
|
var undoManager = self.sessionController.getUndoManager();
|
||||||
undoManager.moveForward(1);
|
undoManager.moveForward(1);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user