Closed Bug 192569 Opened 22 years ago Closed 21 years ago

allow foreign transactions to be added to the queue

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla1.4beta

People

(Reporter: Brade, Assigned: kinmoz)

Details

(Keywords: topembed+)

Attachments

(1 file)

Embeddors should be able to create their own transactions and insert them into
the  editor's undo/redo queue.
Kin suggests we might expose the DoTransaction on nsIEditor.  This would allow
the editor to do merging and other tasks.
Discussed in edt bug triage.  Plussing.  Please try to find alternative to using
nsIEditor which is a private interface.
Keywords: topembedtopembed+
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.4beta
Attached patch Patch Rev 1Splinter Review
It seems that for the most part, embedders are able to pump their own
transactions through the editor. This patch just cleans up a few things:

  1. Added QI to nsPIEditorTransaction to detect foreign transactions
     in PlaceholderTxn::Merge() before attempting to cast it to an (EditTxn*).

  2. Renamed nsIEditor::Do() to nsIEditor::DoTransaction() so it can be called
     from JavaScript.

  3. Cleaned up nsEditor::Begin/EndUpdateViewBatch() so that nothing happens
     outside the mUpdateCount checks.

  4. Added JS code and debug menu items that create and excute a foreign
     transaction via the editor and it's transaction manager.
Attachment #118578 - Flags: review?(jfrancis)
Comment on attachment 118578 [details] [diff] [review]
Patch Rev 1

looks good
Attachment #118578 - Flags: review?(jfrancis) → review+
Attachment #118578 - Flags: superreview?(sfraser)
Comment on attachment 118578 [details] [diff] [review]
Patch Rev 1

-  if (gNoisy) { printf("Editor::Do ----------\n"); }
+  if (gNoisy) { printf("Editor::DoTransaction ----------\n"); }

Can't we clean this up? This code may cause opt builds to link in the static
strings. Does anyone use it any more?
Attachment #118578 - Flags: superreview?(sfraser) → superreview+
Filed bug 199989 to track the removal of gNoisy code from libeditor.
Patch Rev 1 checked into TRUNK:

  mozilla/editor/idl/nsIEditor.idl                           revision 1.17
  mozilla/editor/libeditor/base/nsEditor.cpp                 revision 1.393
  mozilla/editor/libeditor/base/PlaceholderTxn.cpp           revision 1.26
  mozilla/editor/libeditor/html/nsHTMLCSSUtils.cpp           revision 1.19
  mozilla/editor/libeditor/html/nsHTMLEditor.cpp             revision 1.465
  mozilla/editor/libeditor/text/nsTextEditRules.cpp          revision 1.178
  mozilla/editor/ui/composer/content/EditorCommandsDebug.js  revision 1.31
  mozilla/editor/ui/composer/content/editorOverlay.xul       revision 1.230
  mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd  revision 1.117
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment on attachment 118578 [details] [diff] [review]
Patch Rev 1

I'm a touch late commenting on this patch, as it's been checked in, but...

>+function sampleJSTransaction()
>+{
>+  this.wrappedJSObject = this;
>+}
>+
>+sampleJSTransaction.prototype = {
>+
>+  isTransient: false,
>+  mStrData:    "[Sample-JS-Transaction-Content]",
>+  mObject:     null,
>+  mContainer:  null,
>+  mOffset:     null,
...

It's usually better in JS to define properties directly in the constructor
function, and methods as properties of the prototype object.  This is because
the user may construct two or more sampleJSTransaction objects, and the
prototype would be inherited...

+function sampleJSTransaction()
+{
+  this.wrappedJSObject = this;
+  this.isTransient = false;
+  this.mStrData = "[Sample-JS-Transaction-Content]";
+  this.mObject = null;
+  this.mContainer = null;
+  this.mOffset = null;
+}
+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: