You are here: Foswiki>Tasks Web>Item11367 (11 Apr 2012, GeorgeClark)Edit Attach

Item11367: Add Javascript callbacks to get notified after editor changes to/from Raw or WYSIWYG mode.

pencil
Priority: Enhancement
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Extension
Component: TinyMCEPlugin
Branches: trunk
Reported By: ArthurClemens
Waiting For:
Last Change By: GeorgeClark
Current callback functions, stored in arrays tml2html and html2tml, are called before a text change.

If you want to update the editor state (specifically: to update the textarea height), you need a callback after the text has been changed.

Proposal: Add transformCbs Array to FoswikiTiny:
tml2html: new Array(),
// callbacks, attached in plugins
html2tml: new Array(),
// callbacks, attached in plugins
transformCbs: new Array(),
// callbacks, attached in plugins

In the 2 transform "success" functions (both switchToRaw and switchToWYSIWYG), do:
// Call post-transform callbacks attached from plugins
for (var i = 0; i < FoswikiTiny.transformCbs.length; i++) {
    var cb = FoswikiTiny.transformCbs[i];
    cb.apply(editor, [editor, text]);
}

-- ArthurClemens - 18 Dec 2011

Needs to be merged with release branch.

-- ArthurClemens - 18 Dec 2011

Picked up on sync from trunk to 1.1.5

-- GeorgeClark - 23 Mar 2012

Change summary:

Before it has been possible to pass javascript callback functions to get notified on text changes. In some situations it is useful to get notified when the editor state is changed, for instance from WYSIWYG to Wiki text. This enhancement allows to pass editor state change callbacks in transformCbs.

-- ArthurClemens - 23 Mar 2012
 

ItemTemplate edit

Summary Add Javascript callbacks to get notified after editor changes to/from Raw or WYSIWYG mode.
ReportedBy ArthurClemens
Codebase 1.1.4, trunk
SVN Range
AppliesTo Extension
Component TinyMCEPlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:7ac4b92e263f
TargetRelease patch
ReleasedIn 1.1.5
CheckinsOnBranches trunk
trunkCheckins distro:7ac4b92e263f
Release01x01Checkins
Topic revision: r8 - 11 Apr 2012, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy