Giter Site home page Giter Site logo

marucjmar / ember-cli-tinymce Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 19.0 683 KB

The ember wysiwyg editor powered by tinyMCE

Home Page: http://marucjmar.github.io/ember-cli-tinymce

License: MIT License

JavaScript 83.53% HTML 11.48% CSS 0.25% SCSS 0.70% Handlebars 4.04%

ember-cli-tinymce's People

Contributors

amilkey avatar coreypmurphy-regions avatar elimburg avatar marucjmar avatar orf avatar pauln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ember-cli-tinymce's Issues

Acceptance testing the editor

In an Ember acceptance test I'd like to change the text in the tinymce editor, but I can't seem to even find() any element inside the iframe element.

Are there any examples of changing the editor in an acceptance test?

Changing options doesn't change editor

When I change an option in my js, it doesn't update the editor. For instance:

this.set('tinymceOpts.resize', 'both');

doesn't change the editor to be resizable. I also tried changing the width, same result.

Property is set up as follows:

tinymceOpts: {
	height: 300,
	width: 600,
	resize: false,
    selector: "textarea",
    plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste textcolor"
    ],
    toolbar: "insertfile undo redo | styleselect | bold italic | forecolor backcolor | alignleft               aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
	content_css: '/assets/css/bootstrap.min.css'			
},

My html reads:

{{tinymce-editor options=tinymceOpts value=htmlText onValueChanged=(action "htmlChanged")}}

Do I need to do something else to make the editor change?

Changing a view's elementId after creation is not allowed

I need to set the id for multiple rich text editors being rendered on the screen. I rendered the inputs like so:

Template

{{#each this.whys as |why i|}}
  <TinymceEditor
    @elementId="five-whys-{{i}}"
    @value={{why}}
    @onValueChanged={{...}} />
{{/each}}
<button {{on "click" this.addWhy}}>Add Why</button>

Javascript

export default FiveWhy extends Component {
  ...
  
  @tracked
  whys: string[];

  @action
  addWhy() {
    this.whys.push("");
  }
}

Whenever the add why button is clicked and the template is re-rendered, the console shows an error that was thrown that says:

Error: Changing a view's elementId after creation is not allowed
    at Class.set [as elementId] (http://localhost:7357/assets/vendor.js:53558:19)
    at setWithMandatorySetter (http://localhost:7357/assets/vendor.js:51303:24)
    at _set2 (http://localhost:7357/assets/vendor.js:35547:45)
    at http://localhost:7357/assets/vendor.js:36851:9
    at changeProperties (http://localhost:7357/assets/vendor.js:35073:7)
    at setProperties (http://localhost:7357/assets/vendor.js:36844:5)
    at Class.setProperties (http://localhost:7357/assets/vendor.js:47835:39)
    at CurlyComponentManager.update (http://localhost:7357/assets/vendor.js:26147:19)
    at UpdateComponentOpcode.evaluate (http://localhost:7357/assets/vendor.js:69057:15)
    at UpdatingVM.execute (http://localhost:7357/assets/vendor.js:71503:16)

It does not cause any bugs or issues beyond a console log but my ember tests fail because this error is being thrown.

Editor does not work in modal

I am trying to use the editor in a modal, but it does not seem to work.

When I click on one of the action of the editor ( undo etc ) I get the following error:

Cannot read property 'nodeType' of undefined.

I am thankful for any help or lead on this :)

Uncaught TypeError: Cannot read property 'body' of null

I put the extension into a component using v. 0.1.6 and Ember v2.11
When I call the save action from the controller, a content changed event is fired, even though probably the editor has been destroyed already, causing this exception to rise:

Uncaught TypeError: Cannot read property 'body' of null
    at B.getBody (tinymce.min.js:11)
    at B.getContent (tinymce.min.js:11)
    at Class.contentChanged (tinymce-editor.js:30)
    at Backburner.run (ember.debug.js:718)
    at ember.debug.js:1018

Here is the cause:

        // Call onValueChanged if editor content changes
        contentChanged: function contentChanged(editor) {
                this.onValueChanged(editor.getContent());
        },

There would need to be some possiblity to deregister the component before saving.. does anyone know how this could be achieved in a simple way?
Best regards,

Daniel

Update TinyMCE to version 5

It looks like TinyMCE is pushing everyone from version 4 to version 5 - are there any plans to update this to use version 5 or do we all need to jump ship?

The component is broken

Hi,

you broke the component with this commit c28f84d.

You use this in the method contentChanged but it's not bound.

Can you fix this please?

Thanks.

I can't get the value of property defined using the form events

I have a component that uses the addon. When I am using the blur form events it returns the value of property that was defined within the setup. However, when I tried to log the value of a property defined outside the setup or outside the editorOptions it returns undefined. Btw, the word Triggered was logged. When blur was triggered.

Template

      <TinymceEditor
        @options={{this.editorOptions}}
        @value={{this.model.fooBar}}
        @onChange={{fn (mut this.model.fooBar)}}
      />

Component js

  @tracked isFoo = false;

  editorOptions = Object.freeze({
    menubar: false,
    statusbar: false,
    plugins: ["link lists paste"],
    toolbar: ["numlist bullist alignleft aligncenter link bold italic underline"],
    branding: false,
    inline_styles: false,
    content_css: "/cloud/assets/styles/content.css",
    height: 160,
    setup: function (editor) {
      editor.on("blur", function (e) {
        console.log(this.isFoo);
        console.log("Triggered");
      });
    }
  });

Issue: Property defined outside the editor options object returns undefined
Expected: I should be able to log the value of this.isFoo property.

Enable Travis

Hey,
It might be that we have some suggestions or merge requests to add to this project, could you enable travis-ci for the repository so any merge requests can be properly tested before merging?

Focus Out

Is there a way to get the focus out event? and remove the right click options?

Needs option for setting cdn version

Add-on is pointing at specific release of Tinymce via their cdn and is therefor hidden from modification by the app owner/dev. Would be good to have an addtional option to set in the environment.js besides "load: true", that allows setting the version to fetch from the cdn. Currently, the add-on is pointing at 4, which isn't a bad thing since it's following semver, except Tinymce released 4.5.0 this past weekend and caused ordered/unordered list buttons to suddenly disappear from the toolbar. They've not yet acknowledged this issue but being able to specify a release version in our ember apps would help devs to control add-on updating which we're already accustomed to doing in our package and bower json files.

Pull request #5 submitted.

Uncaught TypeError: Cannot read property 'open' of undefined

Hi, I am trying to do a acceptance test. But when I am trying visit the page where the tinymce is being used, it is return Uncaught TypeError: Cannot read property 'open' of undefined.

import { module, test } from "qunit";
import { currentURL, visit } from "@ember/test-helpers";

module("Acceptance | cloud create", function (hooks) {
  setupApplicationTest(hooks);

  test("creating a foo", async function (assert) {
    await visit("/foos/new/overview");
    assert.equal(currentURL(), "/foos/new/overview", "Overview page, filling elements...");
  });
});

templates/foos/new/overview

        <TinymceEditor
          @options={{this.editorOptions}}
          @value={{this.model.description}}
        />

controllers/foos/new/overview

  editorOptions = Object.freeze({
    menubar: false,
    statusbar: false,
    plugins: ["link lists paste"],
    toolbar: ["numlist bullist alignleft aligncenter link bold italic underline"],
    branding: false,
    inline_styles: false,
    content_css: "/cloud/assets/styles/content.css",
    height: "160",
    setup: function (editor) {
      let initial = true;
      let startContent = `<ul id="placeholder">e.g., <li>foo</li><li>bar</li></ul>`;
      editor.on("SetContent", function (e) {
        if (initial && e.content == "") {
          e.target.contentDocument.activeElement.innerHTML = startContent;
        }
      });

      // remove placeholder on focus
      editor.on("focus", function (e) {
        e.target.contentDocument.activeElement.innerHTML = "<p><br data-mce-bogus='1'></p>";
        initial = false;
      });
    }
  });

Versions

   "ember-cli": "~3.15.1",
   "ember-cli-tinymce": "0.4.0",
   "engines": {
     "node": "8.* || >= 10.*"
   },

/config/environment.js

  ENV.tinyMCE = {
    apiKey: 'ib0mcxxzb56rgyftait1g8r4bnkoyu1y2tff02ag29zbeohn', // required
    refererPolicy: "anonymous", //default origin
    version: 5.1, //default 5.5,
    load: true
  }

TypeError: Cannot read property of 'cloneNode' of null...

Getting this error when closing the modal containing the tinymce component. Started getting this error after updating our add on version from 0.0.8 to 0.1.3.

screen shot 2016-12-08 at 1 18 00 pm

Overall, script error is not impacting performance of running app but is blowing up PhantomJS acceptance tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.