28 Commits

Author SHA1 Message Date
buster%netscape.com
4bad1b96b8 * Added nsAutoSelectionReset, a tiny class that resets the selection to what it was before a block transformation.
* Added some code to restore selection after RemoveTextProperty.
* Made a tiny change to the way the editor holds onto the transaction manager, so client (like the ender text control) can
turn undo on and off effectively
* Fixed a bug in IsNodeInline that was causing GetBlockParent to return the wrong parent node (and who knows what
other mischief) where atom compares were being done on strings of different case, for <B>, "b" vs. "B".  The DOM
method nsIDOMElement::GetTagName forced the returned tag name to upper case.  I don't know how long that has
been true, but I assume it's a fairly recent change (or something on our side related to it changed recently) or this method
never would have worked.  I also found a few cases of nsString::Equals that I changed to EqualsIgnoreCase
* Made some general improvements to the interaction between editors and rules, so that the aCancel out param is always
intialized, and all rules with Will... are matched with a Did... call.  Added Will/DidSetTextProperty() and
Will/DidRemoveTextProperty().  This helps enable plain text mode.  Added a skeleton for max length support in text editor.
* fixed some warnings.


git-svn-id: svn://10.0.0.236/trunk@34183 18797224-902f-48f8-a5cc-f745e15eee43
1999-06-08 06:04:51 +00:00
buster%netscape.com
9041cef161 Preparation for ender-based text control
* added focus listener.  Doesn't do much yet, but when focus notifications start appearing, we'll be ready for them.  The code is in
place to hide selection when we lose focus and paint selection when we get focus.  That's probably not quite right, but it's a start.
We will need to be able to determine the distinction between losing focus to another control within our app, and losing focus to
another app.
* added support for disabled and readonly states in the editor.  This is accomplished by having flags set by the client, and letting the
rules system deal with those flags.  The flags I added are:
     TEXT_EDITOR_FLAG_PLAINTEXT   0x01   // only plain text editing is allowed
     TEXT_EDITOR_FLAG_SINGLELINE  0x02   // enter key and CR-LF handled specially
     TEXT_EDITOR_FLAG_PASSWORD    0x04   // text is not entered into content, only a representative character
     TEXT_EDITOR_FLAG_READONLY    0x08   // editing events are disabled.  Editor may still accept focus.
     TEXT_EDITOR_FLAG_DISALBED    0x10   // all events are disabled (like scrolling).  Editor will not accept focus.
* added WillInsertBreak/DidInsertBreak into text rules, so flags could be checked.  This gets us readonly, disabled, and single line
behavior.
* cleaned up the code that allocates, registers, and destroys event listeners.  Thanks to Kin and Simon for cleaning up the
ownership model on the listeners, it was a big help.
* added support for a max text length.  You can now tell the text editor, be no bigger than n characters.


git-svn-id: svn://10.0.0.236/trunk@33153 18797224-902f-48f8-a5cc-f745e15eee43
1999-05-28 21:24:18 +00:00
akkana%netscape.com
392f2f0298 - Rename iDirection enum to ECollapsedSelectionAction
- Initial implementation of Insert HTML


git-svn-id: svn://10.0.0.236/trunk@30432 18797224-902f-48f8-a5cc-f745e15eee43
1999-05-05 23:27:17 +00:00
buster%netscape.com
9a004fa0f0 1. block transformation infrastructure is now in place. We can go ahead and implement interesting
features like set paragraph style, set list type, indent, etc.  I'm sure there's holes in my
implementation that these high level features will make obvious.

2. I've factored a lot of utility methods from several modules into nsEditor as public static methods.
This makes them easily accessable to all, and will help Joe and I remove redundant methods.

3. I changed the HTML tags to lower case, and made all string compares case-insensitive.  No, this
isn't quite the right thing to do, but we don't have atoms from layout yet.  The Right Thing is for us
to reuse those atoms.


git-svn-id: svn://10.0.0.236/trunk@30367 18797224-902f-48f8-a5cc-f745e15eee43
1999-05-05 04:05:19 +00:00
rickg%netscape.com
8832f32e49 sync with nsString2
git-svn-id: svn://10.0.0.236/trunk@29011 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-24 01:39:50 +00:00
buster%netscape.com
1664ba068f vastly improved type-in state handling. smaller and faster
git-svn-id: svn://10.0.0.236/trunk@28704 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-22 14:46:53 +00:00
buster%netscape.com
0af3b54f63 factoring of text property code for reuse.
extended APIs to handle fonts -- the trick here is to allow attributes and values
to effectively describe independent properties.


git-svn-id: svn://10.0.0.236/trunk@28252 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-20 17:49:34 +00:00
rickg%netscape.com
2dd2265b49 sync with nsString2 API
git-svn-id: svn://10.0.0.236/trunk@28234 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-20 07:20:21 +00:00
buster%netscape.com
a907540332 factored out re-parenting of content into MoveContentIntoNewParent
WIP on font handling.


git-svn-id: svn://10.0.0.236/trunk@27862 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-16 18:29:12 +00:00
sfraser%netscape.com
e6296a153a Adapt to fixed selection interface
git-svn-id: svn://10.0.0.236/trunk@27662 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-15 20:20:12 +00:00
jfrancis%netscape.com
427a56fc02 merging in rules work with Simon's selection changes
git-svn-id: svn://10.0.0.236/trunk@27324 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-13 13:35:08 +00:00
sfraser%netscape.com
bbda90e2b0 Updated to conform to new IDL-ized selection interfaces.
git-svn-id: svn://10.0.0.236/trunk@27289 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-13 01:33:32 +00:00
jfrancis%netscape.com
c6d12c638f checkpointing html typing rules
git-svn-id: svn://10.0.0.236/trunk@27152 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-12 12:01:32 +00:00
buster%netscape.com
a29a790970 fixed bug 4517
WIP on remove text attributes


git-svn-id: svn://10.0.0.236/trunk@26317 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-05 20:52:29 +00:00
jfrancis%netscape.com
f104246088 redoing rules architecture
git-svn-id: svn://10.0.0.236/trunk@26297 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-05 17:21:59 +00:00
buster%netscape.com
937b6ed03a Improved setting text property for next type-in (that is, setting text properties with a collapsed selection.) Bold, italic, and underline
all work.  Better error checking, and factored out some common code.


git-svn-id: svn://10.0.0.236/trunk@26223 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-04 20:10:39 +00:00
buster%netscape.com
0fe8e1324d As a reminder, we decided to do this based strictly content. Some support for style-based text properties is written, but not used
anywhere any more.

* Cleaned up split and join undo/redo.
* Added TypeInState, a data struct that remembers things about text properties for collapsed selections, so you can type
* Ctrl-B with an insertion point and the next character will be bold.
* Added all the logic to handle inline vs. block elements when setting text properties.
* Added some support for italic and underline as well.  Adding these things is pretty easy now.  Ctrl-B, Ctrl-I, Ctrl-U for testing bold, italic, underline.
* Added all the logic to make sure we only add style tags where they're needed, so you should never get the same style tag nested within itself, except as needed for block elements.
* Added methods for testing a node to see if a particular style is set.  This isn't 100% done yet, but with very little work we could have toolbar buttons that respond to selection changed notification that show the state of bold, italic, underline, etc. in real time.  Supports tri-state:  whole selection is bold, some of selection is bold, none of selection is bold, ...
* Fully undoable and redoable.
* Added some debug printfs to transactions and editors.  all controlled by a gNoisy static in each module.  helps me track down undo/redo problems.  if the output bugs people enough, I'll shut it off and re-enable it in my local tree.

Noticably missing:  make un-bold, make un-italic, etc.  This is coming soon.


git-svn-id: svn://10.0.0.236/trunk@25869 18797224-902f-48f8-a5cc-f745e15eee43
1999-04-01 17:58:07 +00:00
akkana%netscape.com
dd6ab917f7 Editor: Add Insert Link and Image
git-svn-id: svn://10.0.0.236/trunk@25455 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-29 22:01:26 +00:00
jfrancis%netscape.com
46bf828d41 seperating out html edit rules from text edit rules
git-svn-id: svn://10.0.0.236/trunk@25439 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-29 08:02:05 +00:00
jfrancis%netscape.com
6a6a648796 bug 4057: fix is in layout; here I'm removing the old workaround code
git-svn-id: svn://10.0.0.236/trunk@24664 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-22 09:04:06 +00:00
buster%netscape.com
8851e742d6 fixed join.
made a special case for typing with BR as the selection (as after an InsertBreak.)
made DEL and BACKSPACE at the beginning and end of a text node
fixes bugs 3742 and 3756 (with permission from choff and gkostello)


git-svn-id: svn://10.0.0.236/trunk@24209 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-16 16:38:09 +00:00
buster%netscape.com
506d9a9565 added WillUndo, DidUndo, WillRedo, DidRedo and some supporting code so
the text edit rule object can maintain it's own state more efficiently and correctly.


git-svn-id: svn://10.0.0.236/trunk@24160 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-15 05:08:30 +00:00
buster%netscape.com
ef5f3265cc added PlaceholderTxn. This is an aggregate transaction that sits on the undo stack
and merges in subsequent transactions indiscriminately until it's told to stop.
It also gives the last transaction in its child list a chance to merge the
next transaction.
All this is in support of complex transactions that result in text insertion
being able to collapse into a single undoable event.
Also improved tracking of bogus content node used when document is empty.


git-svn-id: svn://10.0.0.236/trunk@24151 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-15 00:57:32 +00:00
buster%netscape.com
c40ea0b1ef InsertBreak now works at the beginning of a line. Plus a trivial bug fix.
git-svn-id: svn://10.0.0.236/trunk@24057 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-13 05:31:22 +00:00
buster%netscape.com
3900dace67 added delegate code for InsertText (WillInsertText, DidInsertText)
which calls generic WillInsert, DidInsert to test for magic bogus
content and does the right thing.
You now can't delete magic content with user gestures, and when you
insert anything the magic kludgy &nbsp; is deleted first.


git-svn-id: svn://10.0.0.236/trunk@24055 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-13 04:53:21 +00:00
buster%netscape.com
b6be8ea31d deleting the last editable object in a document now causes a bogus placeholder <P>&nbsp;</P> to be added to the document. This node has the
attribute MOZ_EDITOR_BOGUS_NODE set to TRUE.  this solves the problem of when you do a SelectAll then a DEL, you don't have a cursor
or any way to set selection in the document. You do still have the problem that the nbsp is pretty narrow and the frame containing it is hard to hit
with the mouse.  We really need the "set selection to frame nearest the mouse down point" operation.

the intent is for all inserts to look for this node, and if found delete it before the insert.  likewise, all deletes will be no-ops if this node is found.


git-svn-id: svn://10.0.0.236/trunk@23836 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-12 02:28:24 +00:00
sfraser%netscape.com
bbdc2c5a6b Add static to remove warning
git-svn-id: svn://10.0.0.236/trunk@23569 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-10 21:26:33 +00:00
buster%netscape.com
9bcc7a19c2 first cut at rules delegate for text editor, will change drastically in the next week or two
git-svn-id: svn://10.0.0.236/trunk@23547 18797224-902f-48f8-a5cc-f745e15eee43
1999-03-10 19:53:26 +00:00