Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Post editor javascript documentation

Aloittaja Darker, tammikuu 19, 2014, 06:37:25 AP

« edellinen - seuraava »

Darker

Hi,
I'm trying to mod the post editor behavior using client-side user script. Changes I want to do include:

Ask for url when pressing url button.
Automatically generate preview (on client side)
Keyboard shortcuts (i've noticed that editor has some array for this - how to use it?)
Quote selected (highlighted) sentences from previous posts.

I wonder if the editor javascript is documented somewhere, or if I'm to rely on the comments in the .js file.

Please not that I'm not asking for help with my specific ideas, I'm just looking for some docs, before I start figuring it out on my own.

text bellow is probably gonna change often:

I've found this out so far:

Changing the hotkeys:

smc_Editor.prototype.registerShortcut(string shortcutLetter, string funcKeys, string actionCode)

Functional keys must be in format "ctrl, alt". No other keys are supported. At least one should be present.

Overiding the button events?
This is very confusing for me. Every button in the editor is an image, with a onclick event:
function () {
this.instanceRef.handleButtonClick(this);
};

This means that this shoud refer to the image element. However, the handleButtonClick method accepts an options object as 1st argument. How come that this works? Where is the image element converted to the options object?


Arantor

Oh you're going to have so much fun with this, and then do it all again when 2.1 comes out with a completely new editor.

Just for fun the behaviour varies between whether WYSIWYG is enabled or not...
Holder of controversial views, all of which my own.


Darker

In other words there is no proper way to mod the editor?

Arantor

Oh, there's ways to do it but it's a mess because it's undocumented and even we felt it wasn't salvageable which is why 2.1 has a totally different editor.
Holder of controversial views, all of which my own.


emanuele

Actually 2.1 has a completely different editor because someone decided it was worth wasting a bit of time and implement it, otherwise it would still have the old one. :P


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Arantor

Compared to trying to fix all the bugs in the old one, the time spent integrating SCEditor was definitely smaller.
Holder of controversial views, all of which my own.


Advertisement: