Defining property types directly in the HTML

47 views
Skip to first unread message

eriter

unread,
Feb 17, 2013, 9:28:23 PM2/17/13
to crea...@googlegroups.com
Hi, I'm a beginner with createjs and even more so with viejs and rdfa.

I'm quite confused about how createjs / viejs handles property types.
What I'm looking for is a simple way of configuring the editor used for a specific HTML element / rdf property.

but it looks overly complicated when I just want a simple way of controlling which editor is used.
It doesn't seem to be friendly to ad-hoc structures either since you have to explicitly define every property of a type.

How are the rdf-schemas meant to be defined? Is there a more flexible of defining property types?

Henri Bergius

unread,
Feb 18, 2013, 6:12:01 AM2/18/13
to crea...@googlegroups.com
Hi,

On Mon, Feb 18, 2013 at 3:28 AM, eriter <erik.te...@gmail.com> wrote:
> I found this example:
> https://github.com/bergie/create/blob/master/examples/example-withtype.html.
> but it looks overly complicated when I just want a simple way of controlling
> which editor is used.
> It doesn't seem to be friendly to ad-hoc structures either since you have to
> explicitly define every property of a type.

There are several ways to define editors to be used:

* By property types (requires type definitions to be present)
* By property names
* By default

Default editors are the easiest option, as then you can just configure
a single editor to be used for almost all the properties. For examples
of this, check out:
https://github.com/bergie/create/blob/master/examples/example-aloha.html
https://github.com/bergie/create/blob/master/examples/example-redactor.html

For example, to use Redactor instead of Hallo as the default WYSIWYG
editor, you'd need to:

jQuery('body').midgardCreate('configureEditor', 'redactor',
'redactorWidget', {});
jQuery('body').midgardCreate('setEditorForProperty', 'default', 'redactor');

You can then configure additional exceptions, like using plain
contentEditables for titles:

jQuery('body').midgardCreate('configureEditor', 'simple', 'editWidget', {});
jQuery('body').midgardCreate('setEditorForProperty',
'dcterms:title', 'simple');

As you can see, this case uses property name for matching the right
editor, so no type definition is needed.

/Henri

--
Henri Bergius
Motorcycle Adventures and Free Software
http://bergie.iki.fi/

Jabber: henri....@gmail.com
Microblogs: @bergie

eriter

unread,
Feb 18, 2013, 3:08:37 PM2/18/13
to crea...@googlegroups.com
Thanks for the quick response!
Yes, I've experimented some with this. I guess configuring the editor by property type is the closest to what I want to do.

The problem is it seems a bit cumbersome to setup type definitions in vie.js / rdfa.
What is the "correct" way of defining types? Is doing it in Javasript (as per the example) the only way?
I suppose I would want to define property types by annotating the html, something like a typeof / range attribute in the HTML.

I don't know enough about vie.js / rdfa to see if this is perhaps outside the scope of createjs.
In my case customizing the editability of a document is more important than it's mapping to an underlying model.

eriter

unread,
Feb 23, 2013, 5:58:06 PM2/23/13
to crea...@googlegroups.com
My straight forward question is this: Is it possible to manipulate the vie.js type system in HTML?
Reply all
Reply to author
Forward
0 new messages