NetTalk Central

Author Topic: Options for Redactor doesn't work  (Read 3325 times)

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Options for Redactor doesn't work
« on: March 25, 2013, 02:25:54 AM »
Hello

NetTalk:   7.07
Clarion:    8.9759

There is some problem with setting options for Redactor.

I try for example:
    loc:options = p_web.SetOption(loc:options,'source','false') in ! Start of "After Value" embed
to hide source button and it doesn't work.

Is this a bug?
How can I sets options for Redactor?

BTW: Bruce, Are You planning to update Redactor to version 8.2.4?

Regards,
Matthew

« Last Edit: March 25, 2013, 02:31:14 AM by Matthew »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11270
    • View Profile
Re: Options for Redactor doesn't work
« Reply #1 on: March 25, 2013, 05:27:33 AM »
Hi Matthew,

>> Is this a bug?

yes. short answer: fixed in 7.08.

Now for the long answer;

JavaScript has the concept of true and false which are distinct from 1 and 0. It also has two different ways to compare values.
In JavaScript, == is the same as a clarion = - ie it converts types and makes a reasonable comparison. So in clarion if you compare the blank string with 0 it sees that as a true statement. as in

if '' = 0
  ! yes!
end


So in JavaScript the statement
if (a== b)
is true if a = 1 and b = true.

Unfortunately JavaScript also has an "exactly equal" test. They use === for this. so
if (a === b)
is not true if a = 1 and b = true.

Clarion has no real equivalent of this test, and no way to distinguish true from 1.

the Redactor code unfortunately tests options using === - so the parameter has to be false, not 0, and not the string "false".

I've tweaked the 7.08 code to allow for this distinction. You code (in 7.08) would be correct.

cheers
Bruce