Opened 9 years ago

Closed 3 years ago

# [Patch] Save reference to TracWysiwyg object as textarea element attribute

Reported by: Owned by: Erik M. Bray Jun Omae normal TracWysiwygPlugin normal 0.11

### Description

I have a few wiki-related plugins that use JavaScript and that are broken when users have the Wysiwyg mode enable (but work fine otherwise since they're operating on the textarea element). There's not much I can do to get around it without specifically modify the plugins to account for the possibility that the tracwysiwyg plugin is in use, and that's fine. But I found it difficult without this patch, since no reference to the TracWysiwyg object is kept anywhere convenient. So this just attaches it directly to the textarea DOM element itself, which works fine.

### comment:1 Changed 9 years ago by Erik M. Bray

My only concern with this is, which I just noticed, is that it creates a reference cycle. I'll have to see if that really gets to be a problem, but it probably won't.

### Changed 9 years ago by anonymous

An update to this patch so that textareas that already have a wysiwyg editor are skipped in TracWysiwyg.initialize()

### comment:2 Changed 9 years ago by anonymous

The above update to the patch is sort of a corollary that I found useful. Sometimes I dynamically add new elements to a page that should have wysiwyg wiki editing enabled, so I re-call TracWysiwyg.initialize(). But sometimes there are existing elements on the page that already have wysiwyg editing enabled, so I need to skip those.

### comment:3 Changed 3 years ago by Jun Omae

Resolution: → wontfix new → closed

I think that is not good idea to save instance in textarae element. Instead, use TracWysiwyg.findInstance(textarea).

### Modify Ticket

Change Properties