Files
WebODF/programs/editor/plugins/bella/WrappedSessionController.js
T
Philip Peitsch 5e26b5a1e0 Meet Bella. She will destroy your documents.
* Supports multiple instances in the same doc
* Able to exercise entire selection controller
* Can say meow (and other text manipulation actions)
* Knows  about undo & redo
* Will also destroy your document formatting too!
* Can cut, copy & paste
* Bella is a tidy cat and likes valid documents
* Bella can be hooked up to use an existing cursor
* Custom actions to be loaded externally
* Has AMD integration
* Add checks to ensure the cursor is in a valid step.
Issue highlighted in review of PR #451.
* Add a seeded random number generator to allow reproduction of crashes.
Original source: https://github.com/davidbau/seedrandom
* Add some really simple reporting stats
* Allow seed to be specified via URL

Major features
==============
Add an "auto drive" feature (the cat herder)

Auto drive will automatically cycle the page after the specified
number of pounces. If an unhandled exception occurs, it will PUT a
file to the server in the same location that contains the number of
pounces that happened, and the original seed, along with the error
information.

Notes
=====
* Limit how frequently document length checks are performed
* Using a real SessionController causes problems with double-events
2015-06-07 13:16:33 +02:00

42 lines
2.4 KiB
JavaScript

define("webodf/plugins/bella/WrappedSessionController", function() {
"use strict";
var webodf = window;
function WrappedSessionController(session, inputMemberId, sessionController, args) {
var odtDocument = session.getOdtDocument(),
constraints = sessionController.getSessionConstraints(),
sessionContext = new webodf.gui.SessionContext(session, inputMemberId),
objectNameGenerator = new webodf.odf.ObjectNameGenerator(odtDocument.getOdfCanvas().odfContainer(), inputMemberId),
directFormattingController = new webodf.gui.DirectFormattingController(session, constraints, sessionContext, inputMemberId, objectNameGenerator, args.directTextStylingEnabled, args.directParagraphStylingEnabled),
createCursorStyleOp = /**@type {function (!number, !number, !boolean):ops.Operation}*/ (directFormattingController.createCursorStyleOp),
createParagraphStyleOps = /**@type {function (!number):!Array.<!ops.Operation>}*/ (directFormattingController.createParagraphStyleOps),
textController = new webodf.gui.TextController(session, constraints, sessionContext, inputMemberId, createCursorStyleOp, createParagraphStyleOps),
selectionController = new webodf.gui.SelectionController(session, inputMemberId),
mimeDataExporter = new webodf.gui.MimeDataExporter(),
pasteHandler = new webodf.gui.PasteController(session, constraints, sessionContext , inputMemberId);
this.undo = sessionController.undo;
this.redo = sessionController.redo;
this.getSession = function() { return session; };
this.getInputMemberId = function() { return inputMemberId; };
this.getTextController = function() { return textController; };
this.getSelectionController = function() { return selectionController; };
this.getDirectFormattingController = function() { return directFormattingController; };
this.getEventManager = sessionController.getEventManager;
this.simulateCopy = function(range) {
var selectedData = "",
dataTransfer = { setData: function(ignored, text) { selectedData = text; } };
mimeDataExporter.exportRangeToDataTransfer(dataTransfer, range);
return selectedData;
};
this.simulatePaste = function(plainText) {
pasteHandler.paste(plainText);
};
}
return WrappedSessionController;
});