Commit Graph
59 Commits
Author SHA1 Message Date
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
Jos van den Oever bc3e2f9f08 Update to newer Closure Compiler. 2012-12-28 11:59:47 +01:00
Jos van den Oever 2d11ccdd65 Add very buggy implementation of SplitParagraph.
There is more work ahead.
2012-11-16 18:55:19 +01:00
Jos van den Oever 9f1658a806 Add boilerplate for the operation to split a paragraph. 2012-11-16 17:51:49 +01:00
Tobias Hintze 6c027c33ac OpRemoveText: change semantic (negative length); workaround delete
the semantic of a negative length for a delete operation is
to encode the "direction" of the delete or put in other words
the cursor position before the remove operation.
a length of -1 means backwards delete of 1 character;
length of 1 means forward-delete of 1 character

delete did not work because the to-be-deleted text was always
out of the avatar's textnode (because it is RIGHT AFTER it, in
the next textnode sibling)
also removed "text" property of OpRemoveText, as it is incorrect
after the second operation when not playing operations locally
(before receiving them back from the server)
2012-11-13 00:54:02 +01:00
Jos van den Oever 155bf9a4d3 Whitespace fixes. 2012-11-10 11:35:21 +01:00
Friedrich W. H. Kossebau cbe11f8e7b Support home key, by going to begin of paragraph for now
though in empty paragraphs a bug in the counter moves the cursor to the begin
2012-11-09 12:30:13 +01:00
Friedrich W. H. Kossebau 9985bb5a12 Fix paragraphstyle selector to only show named styles for a paragraph
Also use "___" as separator because the memberId is used directly in CSS
2012-11-09 12:23:12 +01:00
Friedrich W. H. Kossebau af07d10ef4 Use term "cursor" instead of "member" when it is just about a cursor 2012-11-09 12:19:55 +01:00
Friedrich W. H. Kossebau a058242e6b Split ops.Document from ops.Session (initial step)
Idea here is to create abstraction as much as possible for all ODF-related
objects, e.g. the cursor objects now belong to and know the ODF document model
they run around in.

Some avatar tests still need fixing/adaption, but from manually testing it
looks good, so commiting now to prevent too much differences.
2012-11-09 12:19:08 +01:00
Friedrich W. H. Kossebau 8369aacb78 Make closure compiler happy (well, she better than us) 2012-11-09 12:13:22 +01:00
Friedrich W. H. Kossebau a788288991 Create a simple RemoveText operation on backspace 2012-11-09 12:13:04 +01:00
Friedrich W. H. Kossebau c61c699227 Fix cursor input handling for firefox 2012-11-09 12:12:05 +01:00
Friedrich W. H. Kossebau 34c32fa25c Get normal characters from keyboard events in SessionController 2012-11-09 12:11:20 +01:00
Friedrich W. H. Kossebau ae0dfcb91b Remove property localMemberId from usermodel, instead have the controller know which is the local user
Also have the caret care for its focus itself on e.g. moving
2012-11-09 12:11:02 +01:00
Friedrich W. H. Kossebau 53a81cc1e8 Make Avatar and Caret unaware of a registerInputListener 2012-11-09 12:10:56 +01:00
Friedrich W. H. Kossebau 389d1c4759 Move last remaining event handling from Caret to SessionController 2012-11-09 11:58:41 +01:00
Friedrich W. H. Kossebau 36b6891d14 Remove SessionImplementation.getLocalMemberid, should not be a property of the session object 2012-11-09 11:57:36 +01:00
Friedrich W. H. Kossebau add136763c Create OpRemoveMember for removing cursors/avatars 2012-11-09 11:57:23 +01:00
Tobias Hintze dbc33f4852 use runtime.getWindow() instead of global window 2012-11-09 11:56:33 +01:00
Friedrich W. H. Kossebau b69a7d94ac Restore old text input state, but now with SessionController and OpInsertText 2012-11-09 11:56:19 +01:00
Friedrich W. H. Kossebau fb46e0b011 Move click handling to SessionController (with a workaround for no cursors yet in Session object) 2012-11-09 11:55:40 +01:00
Friedrich W. H. Kossebau 84045fdeb8 Move input keyhandling from Avatar to SessionController
also implements OpMoveMemberCursor
2012-11-09 11:52:34 +01:00