diff --git a/doc/api/hooks_client-side.md b/doc/api/hooks_client-side.md index 919859417..80dcc52ac 100644 --- a/doc/api/hooks_client-side.md +++ b/doc/api/hooks_client-side.md @@ -261,3 +261,18 @@ This hook is provided to allow whether a given line should be deliniated with mu 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. + +## aceSetAuthorStyle +Called from: src/static/js/ace2_inner.js + +Things in context: + +1. dynamicCSS - css manger for inner ace +2. outerDynamicCSS - css manager for outer ace +3. parentDynamicCSS - css manager for parent document +4. info - author style info +5. author - author info +6. authorSelector - css selector for author span in inner ace + +This hook is provided to allow author highlight style to be modified. +Registered hooks should return 1 if the plugin handles highlighting. If no plugin returns 1, the core will use the default background-based highlighting. diff --git a/src/static/js/ace.js b/src/static/js/ace.js index 83ad9447b..db0d596b8 100644 --- a/src/static/js/ace.js +++ b/src/static/js/ace.js @@ -1,5 +1,5 @@ /** - * This code is mostly from the old Etherpad. Please help us to comment this code. + * This code is mostly from the old Etherpad. Please help us to comment this code. * This helps other people to understand this code better and helps them to improve it. * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED */ @@ -86,7 +86,7 @@ function Ace2Editor() }); actionsPendingInit = []; } - + ace2.registry[info.id] = info; // The following functions (prefixed by 'ace_') are exposed by editor, but @@ -97,7 +97,7 @@ function Ace2Editor() 'applyChangesToBase', 'applyPreparedChangesetToBase', 'setUserChangeNotificationCallback', 'setAuthorInfo', 'setAuthorSelectionRange', 'callWithAce', 'execCommand', 'replaceRange']; - + _.each(aceFunctionsPendingInit, function(fnName,i){ var prefix = 'ace_'; var name = prefix + fnName; @@ -105,18 +105,18 @@ function Ace2Editor() info[prefix + fnName].apply(this, arguments); }); }); - + editor.exportText = function() { if (!loaded) return "(awaiting init)\n"; return info.ace_exportText(); }; - + editor.getFrame = function() { return info.frame || null; }; - + editor.getDebugProperty = function(prop) { return info.ace_getDebugProperty(prop); @@ -221,16 +221,16 @@ function Ace2Editor() // calls to these functions ($$INCLUDE_...) are replaced when this file is processed // and compressed, putting the compressed code from the named file directly into the // source here. - // these lines must conform to a specific format because they are passed by the build script: + // these lines must conform to a specific format because they are passed by the build script: var includedCSS = []; var $$INCLUDE_CSS = function(filename) {includedCSS.push(filename)}; $$INCLUDE_CSS("../static/css/iframe_editor.css"); $$INCLUDE_CSS("../static/css/pad.css"); $$INCLUDE_CSS("../static/custom/pad.css"); - + var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ return '../static/plugins/' + path }); includedCSS = includedCSS.concat(additionalCSS); - + pushStyleTagsFor(iframeHTML, includedCSS); if (!Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) { @@ -304,16 +304,16 @@ window.onload = function () {\n\ $$INCLUDE_CSS("../static/css/iframe_editor.css"); $$INCLUDE_CSS("../static/css/pad.css"); $$INCLUDE_CSS("../static/custom/pad.css"); - - + + var additionalCSS = _(hooks.callAll("aceEditorCSS")).map(function(path){ return '../static/plugins/' + path }); includedCSS = includedCSS.concat(additionalCSS); - + pushStyleTagsFor(outerHTML, includedCSS); // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // (throbs busy while typing) - outerHTML.push('', scriptTag(outerScript), '