Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JaySunSyn/polymer-tinymce
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: hugozap/polymer-tinymce
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 10 commits
  • 6 files changed
  • 1 contributor

Commits on Feb 19, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8573fcc View commit details
  2. Copy the full SHA
    ffec648 View commit details
  3. readme

    hugozap committed Feb 19, 2016
    Copy the full SHA
    9a03852 View commit details

Commits on Mar 21, 2016

  1. contentcss property

    hugozap committed Mar 21, 2016
    Copy the full SHA
    ae0d19f View commit details

Commits on May 5, 2016

  1. Copy the full SHA
    b975df7 View commit details

Commits on May 6, 2016

  1. clean

    hugozap committed May 6, 2016
    Copy the full SHA
    bf64eab View commit details
  2. Copy the full SHA
    f24b643 View commit details
  3. readme update

    hugozap committed May 6, 2016
    Copy the full SHA
    006117b View commit details
  4. format

    hugozap committed May 6, 2016
    Copy the full SHA
    4ac99a5 View commit details
  5. README

    hugozap committed May 6, 2016
    Copy the full SHA
    43c231d View commit details
Showing with 297 additions and 131 deletions.
  1. +4 −1 .gitignore
  2. +10 −0 ForkChangeLog.md
  3. +54 −0 README.md
  4. +4 −2 bower.json
  5. +56 −24 demo/demo-element.html
  6. +169 −104 polymer-tinymce.html
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
bower_components
bower_components
bower_components/*
.#*
#*#
10 changes: 10 additions & 0 deletions ForkChangeLog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## 1.0.1

Added property "buttons". Used to create custom buttons. It's an object, each key is
the button identifier and the value is an object with the following properties:

- text (text to display)
- onclick ( function)
- icon: false ( or icon reference) check tinymce docs


54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,48 @@

A tinymce HTML Editor as an Polymer Element.

# Fork notes

The fork makes it easier to work with events (change), and supports multiple
instances of the editor on the same page.

## Add custom buttons easily:

E.g Bind the "buttons" property to some property in your parent element

```html
<polymer-tinymce buttons="{{customButtons}}">...
```

```js
customButtons: {
type: Object,
value: {
'someButton': {
'text':'Some custom button here',
'onclick': function(ev) {
alert('custom action');
}
}
}
```
## Supported events:
* init
* focus
* change
( fixed events 'this' scope )
## change event:
change event receives the new html content ( see demo page for example )
## Support for multiple instances
Each text area will have a unique id, to avoid conflicts with other instances
```
<polymer-tinymce id="editor"
tinytoolbar="insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
@@ -29,4 +71,16 @@ Get and set content:
</script>
```
## Test environment
Install polyserve
npm install -g polyserve
And run polyserve on the main directory. Then go to
[http://localhost:8080/components/polymer-tinymce/demo/index.html](http://localhost:8080/components/polymer-tinymce/demo/index.html)
To test the component
![Demo Pic](http://www.synappses.com/wp-content/uploads/2015/06/tinymceDemo.png "Polymer-Tinymce")
6 changes: 4 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polymer-tinymce",
"version": "1.0.0",
"version": "1.0.1",
"authors": [
"Jalal Fathi <jfathi.mail@gmail.com>"
],
@@ -27,6 +27,8 @@
},
"devDependencies": {
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"paper-elements": "PolymerElements/paper-elements#^1.0.1"

}
}
80 changes: 56 additions & 24 deletions demo/demo-element.html
Original file line number Diff line number Diff line change
@@ -3,36 +3,68 @@
<link rel="import" href="../polymer-tinymce.html">

<dom-module id="demo-element" is="dom-bind">
<template>
<template>

<polymer-tinymce id="editor"
tinytoolbar="insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
tinyplugins='["template advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table contextmenu paste"]'
templates='[
{"title": "Some title 1", "description": "Some desc 1", "content": "My content"},
{"title": "Some title 2", "description": "Some desc 2", "url": "http://google.com"}]'
></polymer-tinymce>
<polymer-tinymce id="editor" buttons="{{customButtons}}"
tinytoolbar="insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
tinyplugins='["template advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table contextmenu paste"]'
templates='[
{"title": "Some title 1", "description": "Some desc 1", "content": "My content"},
{"title": "Some title 2", "description": "Some desc 2", "url": "http://google.com"}]'
></polymer-tinymce>

<paper-input id="contentInput" placeholder="Content" value="Hi this is <strong>Jalal</strong>!"></paper-input>
<paper-button on-tap="setContent" raised>Set Content</paper-button>
<paper-button on-tap="getContent" raised>Get Content</paper-button>
<paper-input id="contentInput" placeholder="Content" value="Hi this is <strong>Jalal</strong>!"></paper-input>
<paper-button on-tap="setContent" raised>Set Content</paper-button>
<paper-button on-tap="getContent" raised>Get Content</paper-button>

</template>
<hr>

<script>
Polymer({
<h2>Another editor</h2>

<polymer-tinymce id="editor2"
tinytoolbar="insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
tinyplugins='["template advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table contextmenu paste"]'
templates='[
{"title": "Some title 1", "description": "Some desc 1", "content": "My content"},
{"title": "Some title 2", "description": "Some desc 2", "url": "http://google.com"}]'
></polymer-tinymce>

is: "demo-element",
</template>

getContent:function(){
this.$.contentInput.value = this.$.editor.getContent();
},
<script>
Polymer({

setContent:function(){
this.$.editor.setContent(this.$.contentInput.value);
}
is: "demo-element",
properties: {

customButtons: {
type: Object,
value: {
'someButton': {
'text':'Some custom button here',
'onclick': function(ev) {
alert('custom action');
}
}
}
}
},

});
</script>
getContent:function(){
this.$.contentInput.value = this.$.editor.getContent();
},

</dom-module>
setContent:function(){
this.$.editor.setContent(this.$.contentInput.value);
},

ready: function() {
this.$.editor.addEventListener('change', function(ev) {
console.log('Editor content changed', ev.detail);
})
}

});
</script>

</dom-module>
Loading