PANmedia / raptor-editor

Raptor, an HTML5 WYSIWYG content editor!
www.raptor-editor.com
GNU General Public License v3.0
533 stars 136 forks source link

The style buttons don't work when using previewTimeout #154

Closed atomiku closed 10 years ago

atomiku commented 10 years ago

The latest build of raptor.js has a previewTimeout = 500; in the PreviewButton(options) function. I noticed that if I select some text and try to apply bold, underline, text align etc that it won't work unless I've waited for it to preview the style first.

How can you replicate this? Download the latest build of raptor, try and select some text and make it bold by clicking the bold button straight away, before the preview kicks in.

I fixed this by setting previewTimeout to 1. Ideally I'd like to disable preview but even with the below settings, the buttons still preview the styles:

function PreviewButton(options) {
    this.preview = false;
    this.previewing = false;
    this.previewTimeout = 1;
    this.previewTimer = null;
    Button.call(this, options);
}
Petah commented 10 years ago

Hi,

I tried as you explained but I couldn't reproduce this. I even upped the timeout to 10,000.

You can disable previewing by setting preview: false in your options.

$('.editable').ratpor({
    preview: false,
    ...
});
atomiku commented 10 years ago

If I disable the preview, the toolbar buttons will no longer work. If I select some text and try to make it bold, after I click bold the text is deselected any no style changes have occurred.

It works fine on the demo pages, but they are using preview without a timeout. If it helps, I've tried on Firefox/Safari/Chrome on Mac 10.6.8 - all the same result. This is using the latest download of raptor editor.

I can't provide you with a URL just yet, as the project is private. But perhaps I can isolate the elements and put them into a page that I can put online, so you can see. There's definitely a bug in here somewhere, unless it is to do with another javascript interfering...

Petah commented 10 years ago

I added a param to disable preview on the example pages. It working fine for me, does it work for you?

https://www.raptor-editor.com/download/example/ffd210654292525ad487aa565cdba3bda2823eee?no-preview

atomiku commented 10 years ago

This bug was fixed some point between 1.2 and 1.4.1.