From 3fe3df91aee6618737feb2a4c1366276c14f0cb1 Mon Sep 17 00:00:00 2001 From: Gedion Date: Sun, 30 Sep 2012 17:13:14 -0500 Subject: [PATCH 1/3] update docs for new hooks and ace exposures --- doc/api/editorInfo.md | 11 ++++++ doc/api/hooks_client-side.md | 68 ++++++++++++++++++++++++++++++++++++ doc/api/hooks_server-side.md | 13 +++++++ 3 files changed, 92 insertions(+) diff --git a/doc/api/editorInfo.md b/doc/api/editorInfo.md index e4322e9e..a212ff08 100644 --- a/doc/api/editorInfo.md +++ b/doc/api/editorInfo.md @@ -45,3 +45,14 @@ Returns the `rep` object. ## editorInfo.ace_doInsertUnorderedList(?) ## editorInfo.ace_doInsertOrderedList(?) ## editorInfo.ace_performDocumentApplyAttributesToRange() +## editorInfo.ace_getAuthorInfos() +## editorInfo.ace_performDocumentReplaceRange(?) +## editorInfo.ace_performDocumentReplaceCharRange(?) +## editorInfo.ace_renumberList(?) +## editorInfo.ace_doReturnKey() +## editorInfo.ace_isBlockElement(?) +## editorInfo.ace_getLineListType(?) +## editorInfo.ace_caretLine() +## editorInfo.ace_caretColumn() +## editorInfo.ace_caretDocChar() +## editorInfo.ace_isWordChar(?) diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md index f706f6a1..707800f5 100644 --- a/doc/api/hooks_client-side.md +++ b/doc/api/hooks_client-side.md @@ -174,3 +174,71 @@ Things in context: This hook gets called every time the client receives a message of type `name`. This can most notably be used with the new HTTP API call, "sendClientsMessage", which sends a custom message type to all clients connected to a pad. You can also use this to handle existing types. `collab_client.js` has a pretty extensive list of message types, if you want to take a look. + +##aceStartLineAndCharForPoint-aceEndLineAndCharForPoint +Called from: src/static/js/ace2_inner.js + +Things in context: + +1. callstack - a bunch of information about the current action +2. editorInfo - information about the user who is making the change +3. rep - information about where the change is being made +4. root - the span element of the current line +5. point - the starting/ending element where the cursor highlights +6. documentAttributeManager - information about attributes in the document + +This hook is provided to allow a plugin to turn DOM node selection into [line,char] selection. +The return value should be an array of [line,char] + +##aceKeyEvent +Called from: src/static/js/ace2_inner.js + +Things in context: + +1. callstack - a bunch of information about the current action +2. editorInfo - information about the user who is making the change +3. rep - information about where the change is being made +4. documentAttributeManager - information about attributes in the document +5. evt - the fired event + +This hook is provided to allow a plugin to handle key events. +The return value should be true if you have handled the event. + +##collectContentLineText +Called from: src/static/js/contentcollector.js + +Things in context: + +1. cc - the contentcollector object +2. state - the current state of the change being made +3. tname - the tag name of this node currently being processed +4. text - the text for that line + +This hook allows you to validate/manipulate the text before it's sent to the server side. +The return value should be the validated/manipulated text. + +##collectContentLineBreak +Called from: src/static/js/contentcollector.js + +Things in context: + +1. cc - the contentcollector object +2. state - the current state of the change being made +3. tname - the tag name of this node currently being processed + +This hook is provided to allow whether the br tag should induce a new magic domline or not. +The return value should be either true(break the line) or false. + +##disableAuthorColorsForThisLine +Called from: src/static/js/linestylefilter.js + +Things in context: + +1. linestylefilter - the JavaScript object that's currently processing the ace attributes +2. text - the line text +3. class - line class + +This hook is provided to allow whether a given line should be deliniated with multiple authors. +Multiple authors in one line cause the creation of magic span lines. This might not be suit you and +now you can disable it and handle your own deliniation. +The return value should be either true(disable ) or false. diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 06ec7374..854b4339 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -136,3 +136,16 @@ function handleMessage ( hook, context, callback ) { } }; ``` + + +## getLineHTMLForExport +Called from: src/node/utils/ExportHtml.js + +Things in context: + +1. apool - pool object +2. attribLine - line attributes +3. text - line text + +This hook will allow a plug-in developer to re-write each line when exporting to HTML. + From 61022be6e422e3608bb15cb230f862e0417239e8 Mon Sep 17 00:00:00 2001 From: Gedion Date: Mon, 1 Oct 2012 19:14:27 -0500 Subject: [PATCH 2/3] added comments to ace exposed methods --- doc/api/editorInfo.md | 22 +++++++++++++++++----- doc/api/hooks_client-side.md | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/doc/api/editorInfo.md b/doc/api/editorInfo.md index a212ff08..6aec326e 100644 --- a/doc/api/editorInfo.md +++ b/doc/api/editorInfo.md @@ -45,14 +45,26 @@ Returns the `rep` object. ## editorInfo.ace_doInsertUnorderedList(?) ## editorInfo.ace_doInsertOrderedList(?) ## editorInfo.ace_performDocumentApplyAttributesToRange() + ## editorInfo.ace_getAuthorInfos() -## editorInfo.ace_performDocumentReplaceRange(?) -## editorInfo.ace_performDocumentReplaceCharRange(?) -## editorInfo.ace_renumberList(?) +Returns an info object about the author. Object key = author_id and info includes athour's bg color value. +Use to define your own authorship. +## editorInfo.ace_performDocumentReplaceRange(start, end, newText) +This function replaces a range (from [x1,y1] to [x2,y2]) with `newText`. +## editorInfo.ace_performDocumentReplaceCharRange(startChar, endChar, newText) +This function replaces a range (from y1 to y2) with `newText`. +## editorInfo.ace_renumberList(lineNum) +If you delete a line, calling this method will fix the line numbering. ## editorInfo.ace_doReturnKey() -## editorInfo.ace_isBlockElement(?) -## editorInfo.ace_getLineListType(?) +Forces a return key at the current carret position. +## editorInfo.ace_isBlockElement(element) +Returns true if your passed elment is registered as a block element +## editorInfo.ace_getLineListType(lineNum) +Returns the line's html list type. ## editorInfo.ace_caretLine() +Returns X position of the caret. ## editorInfo.ace_caretColumn() +Returns Y position of the caret. ## editorInfo.ace_caretDocChar() +Returns the Y offset starting from [x=0,y=0] ## editorInfo.ace_isWordChar(?) diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md index 707800f5..55d1da00 100644 --- a/doc/api/hooks_client-side.md +++ b/doc/api/hooks_client-side.md @@ -239,6 +239,6 @@ Things in context: 3. class - line class This hook is provided to allow whether a given line should be deliniated with multiple authors. -Multiple authors in one line cause the creation of magic span lines. This might not be suit you and +Multiple authors in one line cause the creation of magic span lines. This might not suit you and now you can disable it and handle your own deliniation. -The return value should be either true(disable ) or false. +The return value should be either true(disable) or false. From 60099030952e997c9e5bdc9e72da250afb35792c Mon Sep 17 00:00:00 2001 From: Gedion Date: Mon, 1 Oct 2012 19:18:19 -0500 Subject: [PATCH 3/3] added comments to ace exposed methods --- doc/api/editorInfo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/editorInfo.md b/doc/api/editorInfo.md index 6aec326e..05656bce 100644 --- a/doc/api/editorInfo.md +++ b/doc/api/editorInfo.md @@ -47,7 +47,7 @@ Returns the `rep` object. ## editorInfo.ace_performDocumentApplyAttributesToRange() ## editorInfo.ace_getAuthorInfos() -Returns an info object about the author. Object key = author_id and info includes athour's bg color value. +Returns an info object about the author. Object key = author_id and info includes author's bg color value. Use to define your own authorship. ## editorInfo.ace_performDocumentReplaceRange(start, end, newText) This function replaces a range (from [x1,y1] to [x2,y2]) with `newText`.