Commit Graph
81 Commits
Author SHA1 Message Date
Lu Li fea0502aed refactor keyboard handling 2013-07-15 12:13:22 +02:00
Lu Li c8fea6ee12 rename and re-arrange some of the cursor operations 2013-07-15 12:13:22 +02:00
Lu Li 161c7d8562 refactor cursor related operations
set alias for session.getOdtDocument()
refactor common OpMoveCursor creation into new methods
2013-07-15 12:13:22 +02:00
Lu Li b61fa9933d move cursor to beginning/end of the line 2013-07-10 18:00:41 +10:00
Philip Peitsch 273cad46f5 Improve documentation around the undo manager
Once conceptual change is the move away from the very overloaded "steps"
term into states. A state may be made up of one or more operations,
depending on the implementation of the undo manager.
2013-07-09 15:03:53 +02:00
Philip Peitsch a3dd2374dd SessionController now better hides absence of an undo manager
Consumers of the SessionController would all need to check if and how
undo was supported. As a result, it makes more sense to simply expose
the necessary signals for UI purposes, and encapsulate how the signals
are bound inside SessionController
2013-07-09 02:18:34 +10:00
Philip Peitsch e2b477968f Implemented trivial singler-user only undo manager
This manager supplies really simple undo and redo behaviour. Undo is
achieved by resetting the document back to the initial state, and
replaying all operations on top of it.

This undo mechanism is not suitable for a networked operation sessions
as there is no attempt to communicate the resetting of the document
state.

Initial undo state for a document is set when startEditing is called on
a session. This state is effectively a clean document with the local
cursor added to it.

* Added undo/redo buttons to the editor
2013-07-09 01:48:24 +10:00
Philip Peitsch 76e6d463bb Fix copy support in Epiphany 2013-07-08 15:31:14 +02:00
Philip Peitsch ae161c66bd Fix paste support in Epiphany 2013-07-08 15:29:22 +02:00
Lu Li 0b105d0e97 handle shift+up/down plus some refactoring 2013-07-08 15:26:02 +02:00
Lu Li 6a3b2075df refactor click related functionalities to ClickHandler.js 2013-07-08 15:25:22 +02:00
Lu Li dd9c0fec51 double click to select word and triple click to select parapraph 2013-07-08 15:25:22 +02:00
Philip Peitsch a471ee42da Added basic cut support for Chrome and Safari
The one caveat with this is that Paste in Safari is still
unsupported as Safari blocks the command on
read-only elements (a security feature perhaps?).

Neither cut or paste work on Firefox.
2013-07-05 11:04:18 +02:00
Philip Peitsch 715d767118 Fix error triggered when calling OdtDocument.endEditing related maintainCursorSelection
As per some previous commits, the maintainCursorSelection behaviour is only valid
while there is a cursor on the document. This is now properly unsubscribed when
endEditing is called.
2013-07-05 11:04:18 +02:00
Lu Li 4a00052792 handle ctrl+shift+up/down & ctrl+shift+home/end
handle ctrl+home/end
2013-07-05 11:04:18 +02:00
Friedrich W. H. Kossebau f558e33231 During initial ops replay there is no own cursor yet added, so either test for the cursor or do not do cursor-using things 2013-07-03 14:57:28 +02:00
Philip Peitsch 9b72010946 Fix support for reverse selections
Recent changes to make OpRemoveText accept positive lengths
only broke reverse selections, as a reverse selection will generate a
negative length (the focus node is BEFORE the anchor node)
2013-07-03 13:19:05 +02:00
Friedrich W. H. Kossebau e32bc7c9c9 Simplify OpRemoveText by only allowing positive length 2013-07-02 23:11:21 +02:00
Friedrich W. H. Kossebau c71bdb30bf Remove unused property "styleNameBefore" from spec of ops.OpSetParagraphStyle 2013-07-02 22:35:49 +02:00
Philip Peitsch 2c615d5880 Fixed incorrect offset coordinate usage with unfilteredDomOffset 2013-07-02 21:31:28 +02:00
Lu Li ae3e5c4c4c support extend/decrease a text selection by press SHIFT + LEFT/RIGHT 2013-07-02 21:28:12 +02:00
Philip Peitsch 2d8640becb Preserve the current user selection during formatting changes 2013-07-02 21:19:36 +02:00
Philip Peitsch 945c0fbfbf Added support for range deletion using the delete key
Implemented support for range selection in edit mode

Works similarly to the existing cursor. A node is
placed in for the start and end positions of a cursor.

The window selection is updated based on cursor moved events.
The selection sync logic really belongs in SessionView. However,
as only a single selection is supported in the current
implementation, this has been temporarily put into SessionController.

A new function OdtDocument.getCursorSelection has been added
to make it trivial to support range-selection operations.

Fixed lost-in-translation
2013-06-20 02:26:35 +10:00
Philip Peitsch 17bfeef382 Added support for range deletion using the backspace key 2013-06-20 02:26:35 +10:00
Philip Peitsch 135c8affc9 Support range selection in edit mode
Works similarly to the existing cursor. A node is
placed in for the start and end positions of a cursor.

The window selection is updated based on cursor moved events.
The selection sync logic really belongs in SessionView. However,
as only a single selection is supported in the current
implementation, this has been temporarily put into SessionController.

A new function OdtDocument.getCursorSelection has been added
to make it trivial to support range-selection operations.

* Move responsibility for setting the memberId into Cursor to
  allow proper hiding of anchor node
2013-06-20 02:26:29 +10:00
Friedrich W. H. Kossebau a395556e79 Change the spec of OpMoveCursor to contain the absolute target position, not a relative one 2013-06-19 14:36:52 +02:00
Philip Peitsch ff4033be4b OdtDocument.getDistanceFromCursor expects filtered offsets
* Fixed api comments incorrectly claiming unfiltered offsets
2013-06-12 11:00:01 +02:00
Philip Peitsch 4c42388d90 Backspace needs to be always consumed to stop the browser navigating back a page 2013-06-11 11:48:55 +02:00
Lu Li e4a092d114 add event listeners when a new edit session starts and remove all of them when finish editing 2013-06-07 10:17:44 +02:00
Aditya Bhatt d9a4dfbb49 Cursor up/down movements are here!
Handle an edge case (literally) where you move up/down at the far right
of a word-wrapped paragraph (but not at the end).
2013-06-07 09:50:04 +02:00
Aditya Bhatt de2e318034 Fix the occasional "could not read property namespaceURI of null" error.
And make the click-to-move function properly when:
   * Clicking on a cursor (do nothing)
   * Clicking in an empty paragraph with a visible editinfo
2013-05-29 14:23:57 +02:00
Jos van den Oever 51fe1f37dd Compile fix. 2013-05-29 12:31:39 +02:00
Lu Li 9cdfd67342 handle the onpaste event for plain text copy/paste 2013-05-29 16:24:20 +10:00
Friedrich W. H. Kossebau f8379c5799 prevent selections appearing on first cursor movement after positioning the cursor with the mouse (with older WebKit) 2013-05-08 14:52:54 +02:00
Friedrich W. H. Kossebau 7dbd8bf48c Do not create a cursor move for both "click" and "mouseup" event, only the latter 2013-05-07 19:32:55 +02:00
Jos van den Oever 6cf4da633d Change from collapse() to collapseToStart().
The meaning of the parameters in collapse() seems to differ between browsers. collapseToStart seems more consistent.
2013-05-06 16:58:21 +02:00
Friedrich W. H. Kossebau bd07b2c8a9 Support END key, by going to end of paragraph for now 2013-05-03 19:12:38 +02:00
Jos van den Oever 8492ef7848 Fix compilation: Closure Compiler wants two arguments for collapse(). 2013-05-02 19:29:50 +02:00
Jos van den Oever 6eaceefa6f Fix selection problem that occurs in cursor movement by clicking.
Sometimes a selection would appear when the cursor was moved by clicking. This is fixed by explicitly collapsing the selection which effectively makes it invisible. In addition the onmouseup event is also registered to move the cursor. The onclick event does not suffice to catch all user actions intended to move the cursor.
2013-05-02 18:33:22 +02:00
Friedrich W. H. Kossebau 7741d55f2e Create new class odf.Namespaces 2013-04-18 10:46:24 +02:00
Friedrich W. H. Kossebau 6f5ced4d1e Do not pass session as parameter to the ops contructors, pass odtDocument instead of domroot in the execute method 2013-04-09 13:45:33 +02:00
Aditya Bhatt 9182956538 Don't set the text that is deleted with removeText to "" if the offset
is zero, *delete* that textNode. So that we can avoid multiple textNodes
after backspacing.
Important: SessionController allowed removeText operations to be fired
if the position was -1. This caused a lot of nodes *after* the cursor to
be deleted in 'bulk' if you pressed backspace at the first position of the
document. Disallow that.
2013-04-03 18:55:25 +05:30
Tobias Hintze c23067a494 removing verbosity on js console 2013-03-20 15:48:21 +01:00
Friedrich W. H. Kossebau 6a568a8f58 Split ops.OdtCursor from core.Cursor & rename ops.Document to ops.OdtDocument
Also:
* rename gui.CaretTests to ops.OdtCursorTests (as it is testing ops.OdtCursor)
* remove test-less CaretTests.js, had broken setup now
2013-03-06 15:44:28 +01:00
Friedrich W. H. Kossebau 020fe22a0c Prevent the own cursor to be moved to end/begin of document on mouseclicks onto avatarcaretflags or carets 2013-02-13 13:47:53 +01:00
Friedrich W. H. Kossebau 6e80cacefc Use the canvas element to grab all input, ensure caret visibility ourselves 2013-02-11 17:59:59 +01:00
Friedrich W. H. Kossebau 78a3e573e0 Add (for now disabled) code to ops.SessionController to set next-style on paragraph-splitting 2013-01-07 15:21:54 +01:00
Friedrich W. H. Kossebau 94e5408106 improve OpSplitParagraph to also handle any text:spans
also moves implementation from Document to the op class

unsolved: own cursor loses focus if moved into split paragraph
2012-12-28 13:21:40 +01:00
Friedrich W. H. Kossebau 3c59cdb3c0 Be greedy and eat the key event for the "End" button, so the browser does not have it 2012-12-28 12:05:06 +01:00
Friedrich W. H. Kossebau 2a7fb73489 Disable creation of OpSplitParagraph ops, are broken ATM 2012-12-28 12:05:06 +01:00