Ticket #208 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

examples do not work locally with FF3: provide test + visible warning.

Reported by: augustin Owned by: augustin
Priority: minor Milestone: 1.0
Component: documentation Version: trunk
Keywords: Cc:

Description

Hello,

First of all, I am very happy to have found this project. From what I understand from the feature list, it is what I was looking for!

I have successfully made a very basic install using the Drupal wysiwyg.module.

Now, I would like to configure wymeditor to add span with specific classes. However, I cannot find the documentation that explains how to go about it.

The wiki does not seem to cover what I want to do. The page  https://trac.wymeditor.org/trac/wiki/0.5/Customization is a bit obtuse.

The examples included with the source do not work at all. With Firefox 3.5.9 on Kubuntu, opening any of the .html files gives me a strange box with many terms in curly brackets and nothing seems to work (do I need to attach a screenshot?). (Yet, wymeditor works well on my test drupal site).

If required, I can split this ticket into several ones. The main point here is that I am at a complete loss as to how to proceed to customize the wymeditor experience.

By default the list of classes is empty and I don't know how to add any.

Attachments

208.patch Download (1.4 KB) - added by augustin 2 years ago.

Change History

comment:1 Changed 2 years ago by augustin

  • Milestone changed from 0.5.x to 0.5

Oh! Browsing the examples on my local computer does not work. However, I found that it works online here:  http://files.wymeditor.org/wymeditor/trunk/src/examples/

comment:2 Changed 2 years ago by augustin

  • Summary changed from lacking documentation to examples do not work locally

Now that I can see online what it is supposed to be doing, I understand better how it works.

The examples do not work in my browser locally, but they work online. Is this a bug in the source code of the examples?

comment:3 Changed 2 years ago by mr_lundis

  • Status changed from new to closed
  • Resolution set to invalid

Examples doesn't work locally due to browser security policies (see the README inside the examples folder.)

comment:4 Changed 2 years ago by augustin

  • Priority changed from major to minor
  • Status changed from closed to reopened
  • Resolution invalid deleted
  • Summary changed from examples do not work locally to examples do not work locally with FF3: provide test + visible warning.

Thanks mr_lundis. Indeed it works now. The worse thing is that I *did* read the README file. It's the first thing I did. I saw nothing of import to me, but the last three lines, which were those that mattered to me were hidden right under the bottom of my screen. I hadn't scrolled down because I thought I saw the whole file.

Anyhow, I am reopening this ticket, because this experience shows the warning could be made more visible. Since I like this project very much, I'd like to contribute a bit (not much but what I can). I downloaded the svn source.

I have been trying to display the warning right into examples/index.html, with a css or js file hiding the warning if it can be loaded. Unfortunately, I have not been able to reproduce the error. (I tried putting my warning-suppressing-css file in a different directory).  http://kb.mozillazine.org/Security.fileuri.strict_origin_policy The page says that if the setting is set to TRUE, it is directories that cannot be read. Reading the source of 01-basic.html, I don't see where directories are being accessed.

Would you know how to create a simple test for this?

comment:5 Changed 2 years ago by augustin

To be more explicit, what I tried is something like this:

In index.html

<link rel="stylesheet" href="../test/ff3-warning.css" type="text/css" />

</head>

<body>
<h1>WYMeditor integration examples</h1>

<p id="ff3-warning" style="color: red;">
Note: Note: if you test the examples locally with FF3, you'll need to turn off
security.fileuri.strict_origin_policy (type about:config in the URL and search
for the value).<br />
More info: <a href="http://kb.mozillazine.org/Security.fileuri.strict_origin_policy">http://kb.mozillazine.org/Security.fileuri.strict_origin_policy</a>.

and the css is simply:

/* If Firefox can load this file, then all is fine. Suppress the warning. */
#ff3-warning {
  display: none;
}

but that's not enough.

comment:6 follow-up: ↓ 8 Changed 2 years ago by augustin

I cannot find where in wymeditor is the code that causes FF3 to fail. If I could see where things break down, I could maybe reproduce it.

Do you know?

comment:7 Changed 2 years ago by mr_lundis

I believe it's the cross-document scripting (the editor content lives inside an iframe) that's causing problems. I think a generic warning/notice would do in the examples index file, something like:

"These examples might work locally in your browser. If you're having problems please see link to wiki page with more info ? or try out the demos online (also a link)."

The wiki page could then contain additional information and possible workarounds.

comment:8 in reply to: ↑ 6 Changed 2 years ago by mr_lundis

Replying to augustin:

I cannot find where in wymeditor is the code that causes FF3 to fail. If I could see where things break down, I could maybe reproduce it.

Do you know?

Local css files can be loaded without problems.

comment:9 Changed 2 years ago by augustin

Yes, I was thinking a simple note within index.html would be a simpler alternative.

Iframe? I was thinking of putting the test within an iframe, but if it is never loaded, that defeats the purpose. Can css or js within an iframe affect the parent document?

Otherwise your ideas are simple and good.

Speaking of wiki, I was browsing it and found a typo which I wanted to correct in this article:  https://trac.wymeditor.org/trac/wiki/Developers/Concepts however, I don't seem to be able to edit it.

Is wiki editing locked by default for newly registered people?

comment:10 Changed 2 years ago by mr_lundis

It indeed seems like wiki editing is locked for newly registered people, and ironically I don't have permission to change the permissions. I'd guess that page editing was turned off after spam issues (trac doesn't even require email verification for new accounts.)

What I can do is to update the pages after your suggestions, but that just won't work in the long run.

I'm looking in to alternate solutions for documentation management, like GitHub wikis or pages, other third party wikis, or setting up a new git repo/branch that syncs with our current server on push (much like GH pages, but hosted by us)...

Do you have any suggestions?

comment:11 Changed 2 years ago by augustin

I do. I forked this discussion into another ticket:  https://trac.wymeditor.org/trac/ticket/211

Back on topic:

Is there a way to access via javascript the values of the FF settings? I checked the official documentation but didn't know where to look. I don't know javascript well enough to know if this is possible at all. I was thinking the value of security.fileuri.strict_origin_policy could somehow be accessed.

If that is not possible, then let's add something in plain text in examples/index.html.

comment:12 Changed 2 years ago by mr_lundis

I would go for a generic plain text notice as the demos doesn't work locally in most modern browsers (IE is not a modern browser.) There's no need to overengineer this, other issues that could use more attention.

comment:13 Changed 2 years ago by mr_lundis

  • Component changed from ui to documentation
  • Milestone changed from 0.5 to 1.0

comment:14 Changed 2 years ago by augustin

  • Owner set to augustin
  • Status changed from reopened to new

Ok, good call. Attached is a simple patch, then.

Just for my general education: would what I proposed in my last comment worked? Are the values of those settings available somehow in some javascript object?

Changed 2 years ago by augustin

comment:15 Changed 2 years ago by augustin

Btw, I didn't add a link to the wiki as you suggested, because there is no such wiki page to link to and I don't have the rights to create one.

comment:16 Changed 2 years ago by mr_lundis

  • Status changed from new to closed
  • Resolution set to fixed

Applied patch in r670 with some minor modifications, hope you don't mind. Either way, thank you for contributing! ;)

comment:17 Changed 2 years ago by augustin

That's even better this way. Thanks for the commit.

Note: See TracTickets for help on using tickets.