Sha256: c29bd6ab932ad07941c6ecba99d709ec401ffc203659d48f3f4fdac09b215786

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

/*
---
 
script: HTML.js
 
description: Wysiwyg for people
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD.Widget.Input
  - LSD/LSD.Mixin.ContentEditable

provides: 
  - LSD.Widget.Input.HTML
  - LSD.Widget.Input.Html
  
...
*/


LSD.Widget.Input.Html = LSD.Widget.Input.HTML = new Class({
  options: {
    tag: 'input',
    pseudos: Array.fast('form-associated', 'value'),
    attributes: {
      contenteditable: 'editor',
      tabindex: 0
    },
    states: Array.fast('editing'),
    events: {
      self: {
        focus: 'edit',
        edit: function() {
          this.openEditor();
        },
        finish: 'closeEditor'
      }
    }
  },
  
  getValue: function() {
    if (this.editing && this.editor) return this.editor.getData();
    return this.element.get('html');
  },
  
  writeValue: function(value) {
    if (this.editing && this.editor) return this.editor.setData(value);
    return this.element.set('html', value);
  }
  
})

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lsd_rails-0.1.2 Packages/lsd-widgets/Source/Input/HTML.js
lsd_rails-0.1.1 Packages/lsd-widgets/Source/Input/HTML.js
lsd_rails-0.1 Packages/lsd-widgets/Source/Input/HTML.js