Giter Site home page Giter Site logo

angular-redactor's People

Contributors

anton-isaykin avatar bisubus avatar brandon-beacher avatar brunoosilva avatar frenkelor avatar markfinger avatar megamaddu avatar osulyanov avatar rmrevin avatar toastercup avatar waffle-iron 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

angular-redactor's Issues

Redactor callbacks with current scope.

How can I use Redactor callbacks while also having access to the current scope?

For example, if I want to change something on Keydown I should supply a keydownCallback as an option like in the provided example:

    redactorOptions.keydownCallback = function triggerKeydown(e){
        console.log("key down!");
    }

But if I want to update something related to the current scope how can I go about that whilst still using the redactorOptions method for supplying callbacks.

E.g. how would I do this?

    redactorOptions.keydownCallback = function triggerKeydown(e){
        scope.doSomething(e); // throws an error because scope is not available
    }

Thoughts?

How creat multiple Toolbars

if use

<div id="toolbar-panel"></div>
<div ng-repeat="item in items">
  <textarea ng-model="items" redactor>{{item.content}}</textarea>
</div>

and setting:

toolbarExternal: '#toolbar-panel'

toolbar worked only in last editor textarea =\

Plugins

Hi Tyler,
First I'd like to thank you for your contribution as this is the best editor I've seen. I just purchased Redactor v10.0.6 and installed your latest version with angular 1.3.5. After working with this the past 2 days, I think the following might help others getting started with some of the advanced features.

  1. I've got all my libs loaded (download plugins)
    'bower_components/redactor/redactor.js',
    'bower_components/redactor/table.js',
    'bower_components/redactor/fullscreen.js',
    'bower_components/redactor/video.js',
    'bower_components/redactor/clips.js',
    'bower_components/redactor/imagemanager.js',
    'bower_components/angular-redactor/angular-redactor.js',
  2. added to app.js angular.module('sailng', [... ,'angular-redactor']...
  3. added to to app.js
    .config(function(redactorOptions) {
    redactorOptions.imageUpload = '/upload';
    redactorOptions.focus = true;
    redactorOptions.enterKey = true;
    redactorOptions.linebreaks = true;
    redactorOptions.pastePlainText = false;
    redactorOptions.buttonSource = true;
    redactorOptions.imageResizable = true;
    redactorOptions.imageEditable = true;
    redactorOptions.imageLink = true;
    redactorOptions.visual = true;// flase for html mode
    redactorOptions.plugins = ['table','fullscreen','video','imagemanager'];
    redactorOptions.buttons =   ['html', 'formatting', 'bold', 'italic', 'deleted',
        'unorderedlist', 'orderedlist', 'outdent', 'indent',
         'image',     'video', 'file','table', 'link', 'alignment', 'horizontalrule','fullscreen','clips']
})

While the upload feature is a bit ticky and requires a good read of documnetation, everything works as expected except
The enterKey does not execute crlf when in a table.
Thanks,
John

Content not being displayed in editor

Hi I just installed the module. I've loaded the redactor libraries and added the directive tag but the content isn't being displayed inside the editor.

I'm using Angular v1.2.1 and Redactor v8.2.2.

Removing the redactor tag and a normal textarea is displayed with the content.

<textarea ng-model="content" class="form-control" name="content" redactor required></textarea>

Minor bug - console errors

I'm using angular-redcator 1.1.5 and redactor 10.2.5
Issue started when we switched to buble & browserify

Seems like it happens after we leave a page with redactor, and redactor can't be found anymore

TypeError: Cannot read property 'code' of undefined
at HTMLTextAreaElement.eval (eval at (redactor.min.js:12), :1:424)

Send CSRF Token

I wanted to add to request body my csrf token. Is there any option or callaback for that task?

Pass Clips Snippets

Hi, guys

I try to pass snippets to clips module, but i don't know what it's the correct way, thanks Guys

$scope.redactorOptions.plugins = ['clips'];

XSS Vulnerability Discovered

Description:
The stored XSS can be triggered once you editing content by using Redactor 3 in HTML Mode.

POC:

  1. I pen-tested the official showcase website of Redactor 3: https://imperavi.com/redactor/, it has a demo editor in its front page.

Then, click the icon to use HTML content mode:
image
2.
inject XSS payload

image

  1. XSS discovered!
    image

Appended elements not removed from the DOM when changing application states

I'm unsure where/why this error is happening and it may be unrelated to angular-redactor but I'm not sure where else to start.

When I'm in an application state that has redactor in the view and I navigate away from that state to a different part of the app, the redactor-toolbar-tooltip remains in the DOM. It's got a style attribute of 'display: none;' so it doesn't actually remain visible, but it persists nonetheless.

If I go back to that state with redactor in the view (or to any state with redactor for that matter) it sticks another set of redactor-toolbar-tooltips into the DOM.

So if the app isn't refreshed for sometime, there could a huge number of these tooltips still stuck in the DOM.

Here's an example:

2016-02-03 at 10 54 am

Any idea why this might be happening?

Error: No such method "code.set" for Redactor

Using Redactor version 10.2.3 along with Browserify and Gulp to include my front-end assets.

The error is coming from like 65, but goes away if you set

element.redactor('code.set', ngModel.$viewValue || '');

to

element.redactor('set', ngModel.$viewValue || '');

However, this then causes a new "Error: No such method "placeholder.toggle" for Redactor" error.

editing text isn't updating ng-model

Hello, I'm trying out your project for the first time tonight. I can set the content of the redactor widget using $scope.content = "replace this content"; However, when editing the text in the control and logging it out, it isn't updating the model.

The html:

<textarea ng-model="content" redactor cols="45" rows="12"></textarea>
<button type="button"
     class="btn btn-mini  btn-success"
     ng-click="saveComment(event)">Save
</button>

js snippet:

$scope.content = "<b> replace this text </b>";

$scope.saveComment = function (event){
            console.log($scope.content);
}

Any tips? It all looks refreshingly simple, but it is 11:30 at night and I could be doing something bone headed. Thanks

Hi, The library??

although the question it's obviously, The library Redactor, it's no free, we need pay this library to use this directive ?? Thanks

using angular-redactor with clickToEdit in div

Hi,

Everything is working great after using the config method (in app.js). The only thing I ma not able to get working is the clickToEdit: true on a div.
I will investigate and try to figere it out, but in case somebody already got it working it would be great to give me a hint.

this.block.setAttribute is not a function

I'm using redactor with text direction plugin.

When trying to mark a block as RTL or LTR, I'm getting: "Uncaught TypeError: this.block.setAttribute is not a function"
Any idea why and how to resolve it?

Thanks in advance!
Yaron

Object has no method 'redactor'

Redactor defines it's main function on $.fn.redactor. On the following line, element is a plain object from angular:

editor = element.redactor(options);

Writing the line like this fixes the problem:

editor = $(element).redactor(options);

Is this not expected?

Tabkey and Focus does not work

Hi there!

First of all thanks a lot for your directive!

I have included this in my web app and use it with the following options:

  $scope.redactorOptions = {
        toolbarExternal: '#page-editor-toolbar',
        focus: true,
        linebreaks: true,
        tabKey: true,
        plugins: [ 'fontfamily', 'fontsize', 'fontcolor', 'table'],
        blurCallback: function (e) {
          $scope.pageSave();
        }
      };

But focus and tabkey settings won't work. Linebreaks, external toolbar and blur Callback works fine.

Do you have an idea?

Regards
Carstem

Plugins not showing anymore

Hi there,

My team switched to V2 and some of the plugins are not working anylonger.

I used to have things like Fullscreen, but now the button does not even show in the toolbar! I load all my plugins, then I have the redactor options in my ctrl as follows:

$scope.redactorOptions = {
plugins: ['table', 'fullscreen', 'video', 'imagemanager', 'clips', 'fontsize', 'fontfamily', 'fontcolor', 'definedlinks'],
buttons: ['html', 'formatting', 'bold', 'italic', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'video', 'file', 'table', 'link', 'alignment', 'horizontalrule', 'fullscreen', 'clips'],
imageUpload: '/upload',
definedLinks: dummyLinks,
focus: true,
enterKey: true,
linebreaks: true,
buttonSource: true,
imageResizable: true,
imageEditable: true,
imageLink: true,
visual: true, // false for html mode
blurCallback: function(e) {
$scope.$apply(function() {
$sce.trustAsHtml($scope.campaign.descriptions[$scope.currentLanguageIndex].Value);
$scope.showRichTextEditor = false;
});
}
};

However, only Bold, italic, strikeout, outdent, indent, image, link and Line are showing up. :(

Anyone can give me some tips?

Error when trying to use plugins

Hi,

I'm trying to load the fullscreen plugin and I'm getting this error:

"ReferenceError: RedactorPlugins is not defined"

This is my code to initialize Redactor:

// Combined modules
angular.module('mean', modules).config(function(redactorOptions) {

//
// Redactor WYSIWYG editor
//

redactorOptions.focus = true;
redactorOptions.lang = 'es';
redactorOptions.plugins = ['fullscreen'];

});

Where do i suppose to define RedactorPlugins? Or at least, what should i modify to make Redactor to accept plugins?

Thanks in advance!

Content isn't loaded in the editor

We have reports by some users that sometimes content isn't loaded in the editor. It happens less than 0,1% of the times, our users have used the editor around 200.000 times without problems but we have around 40 reports of content not being loaded. It's more likely to happen with users with slow connections or that use many photos in their content.

We use the Redactor 9 version and we are not updating to Redactor 10 for this reason.

We have tryed to solve this by gaining more control over the load process so we switched to RequireJS but it didn't solve it.

Analyzing the code we have detected a theorical point in failure in line 29 but we are unable to verify it in the practice.

We modified line 29 this way:

if (scope.redactorLoaded)
ngModel.$setViewValue(value);

Using ng-click or ng-change on a clip

Hello everyone,

I have a list of clips like so:

['Recipient First Name', '<span class="badge" ng-change="test()"><fieldset class="clip" ng-click="test()">abcd</fieldset></span> '],
and I would like to know how can I make the ng-change (or ng-click) work with clips?

Destroy editor when scope is destroyed

Currently the editor is not destroyed when the directive scope is destroyed. This is a problem for us as when switching between editors in our application, redactor just get's re-inited/rendered each time it is selected. Fix:

        scope.$on('$destroy', function () {
          if (angular.isDefined(editor)) {
            $_element.redactor('core.destroy');
          }
        });

Windows 8 table issue/ Win7/8 enter key issue

I wrote imperavi with the below issue and indicated that they really don't support angular. What do you think. I sometimes program on a windows 8 computer with Webstorm 9.0 using nodejs as backend and my preferred stack based on repo (https://github.com/SharePointOscar/MEANS). Not sure what to do.
John

email to Imperavi,
First, thanks for a great product. I've quickly integrated as solution with an AngularJS CMS I wrote. I'm using TylerGarlick's angular-redactor directive with great success and currently have a few issues I haven't resolved.
Tested on windows 8.1 and windows 7 with latest Chrome Version 39.0.2171.99 m

  1. When pressing enter in the textbox or table cell
    the markup shows
    <span class="redactor-invisible-space">

  2. If I press shift+enter the markup shows
    <br>

  3. Only on windows 8.1 with latest Chrome Version 39.0.2171.99 m
    Tables dont display and a 2 by 2 table insert in markup shows
    <br>
    <br>
    <br>
    <br>

Implementing Custom Buttons

Hey. Thanks for working on this. Not so much an issue but I'm wondering the best way to add buttons to the toolbar via the directive so that I can still access the custom image manager, document selector, etc... that we have already built in Angular.

Thanks again,
Matt

Create Release Please

Could you please create a release and also specify the specific version for your different dependencies? At the moment it's playing havoc with deploying to Heroku because I have to keep upping my AngularJS version numbers in my bower file :).

Model binding not working

Hi,

I'm using angular-redactor with the latest available version of redactor on bower (v8.2.2)
Is binding supposed to work for this version? When I debug into the angular-redactor directive, I see that

$_element.redactor('set', ngModel.$viewValue || '');

is called (and $viewValue contains my string "test")

but the value isn't updated in the redactor component.

Is this directive only compatible with redactor 9.x ?

Thanks

toggle toolbar

Is it possible to toggle the toolbar that it would be displayed only on focus? I was able to hide the toolbar by setting the toolbar : false

undefined is not a function

Hi

I'm getting an error on a new install, from what I can tell I have everything installed ok. Do you know what would cause this?

Here is the error

TypeError: undefined is not a function
    at http://dev.rvwd.com/js/angular-redactor.js:36:32
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js:113:78
    at e (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js:33:287)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js:37:1 

It seems to be this line

$timeout(function () {
        editor = $_element.redactor(options);
        ngModel.$render();
      });

textarea auto focused and insert first image not work

Hi, I find some weird thing about this directive plugin, don't have this issue if I directly use redactor

I am use redactor on a textarea within a modal, when model show up, that textarea is focused, I mean the cursor is blink, if start input, everything is find, but if I click one time and then input, the inputed text will go to next line, click multi time have so such issue

another issue is the first image inserted into not show up, I am feeling this two issue are related, how can I not make this textarea focused?

Plugins

Hi - I am using your code and it's working (almost) perfectly.

I have a httpInterceptor that intercepts all ajax requests and adds the Authorization header.

When I use the image upload button in redactor, it doesn't get intercepted - is there a way for your plugin to alter those requests to use angular's $http rather than the standard xhr?

This is problematic

Having this breaks everything, so I had to remove it


(function() {
    'use strict';

    /**
     * usage: <textarea ng-model="content" redactor></textarea>
     *
     *    additional options:
     *      redactor: hash (pass in a redactor options hash)
     *
     */

Tag for bower

Please create tag for version 1.1.1.
Currently bower install gets version 1.0.0.

Error: No such method "set" for Redactor

I found the error in this code :

ngModel.$render = function () {
            if (angular.isDefined(editor)) {
              $timeout(function() {
                $_element.redactor('set', ngModel.$viewValue || '');
              });
            }
          };

for now i've corrected it with this :

ngModel.$render = function () {
            if (angular.isDefined(editor)) {
              $timeout(function() {
                $_element.redactor('insert.set', ngModel.$viewValue || '');
              });
            }
          };

hope can be useful to someone

Redactor3 - angular-redactor-3.js

wasn't quite sure how to add this in, but i just added my own file angular-redactor-3.js
so for folks looking here's the updated code to make it work with Redactor 3

(function() {
    'use strict';

    /**
     * usage: <textarea ng-model="content" redactor></textarea>
     *
     *    additional options:
     *      redactor: hash (pass in a redactor options hash)
     *
     */

    var redactorOptions = {};

    angular.module('angular-redactor', [])
        .constant('redactorOptions', redactorOptions)
        .directive('redactor', ['$timeout', function($timeout) {
            return {
                restrict: 'A',
                require: 'ngModel',
                link: function(scope, element, attrs, ngModel) {

                    // Expose scope var with loaded state of Redactor
                    scope.redactorLoaded = false;

                    var updateModel = function updateModel(value) {
                            // $timeout to avoid $digest collision
                            $timeout(function() {
                                scope.$apply(function() {
                                    ngModel.$setViewValue(value);
                                });
                            });
                        },
                        options = {
                            callbacks: {
                                changed: updateModel
                            }
                        },
                        additionalOptions = attrs.redactor ?
                            scope.$eval(attrs.redactor) : {},
                        editor;

                    angular.extend(options, redactorOptions, additionalOptions);

                    // put in timeout to avoid $digest collision.  call render()
                    // to set the initial value.
                    $timeout(function() {
			editor = $R(element[0], options);
                        ngModel.$render();
                    });

                    ngModel.$render = function() {
                        if(angular.isDefined(editor)) {
                            $timeout(function() {
				$R(element[0], 'source.setCode', ngModel.$viewValue || '');
                                scope.redactorLoaded = true;
                            });
                        }
                    };
                }
            };
        }]);
})();

API method Toolbar set to false don't show the content of the ng-model

When setting the "{toolbar: false}" in the redactor directive in a textarea resultin a unexpected behaviour of not showing the the content of the ng-model.
Using the for example redactor= "{air :true}" in the textarea is functioning like expected and showing the data of the ng-model. And the air toolbar will show after the normal double click.

Any idea's

Publish to npm

Would be nice to also support installing this package via npm.

If you would prefer to not actually publish, having a package.json file that points to the appropriate main script would suffice.

I would have gladly submitted a PR for the change, but I didn't want to generate the package.json file as there are fields such as author, license, etc that are probably more appropriate for you to handle.

Problem with Just Attribute

I could not get it to work as just an attribute. I think the timeout was not working correctly and it wasn't ready. I had to do this in my controller:

        angular.element(document).ready(function () {
            $('.wysiwyg').redactor();
        });

ngModel's value is not updating in html mode in Redactor II

I'm experiencing an issue with Redactor II and angular-redactor directive.

While using Source plugin (HTML mode), the ngModel value is not getting updated. It works fine with normal editor mode.

I've hosted the example at - http://redactor-2-demo.herokuapp.com

Here is the recording of the bug - http://recordit.co/9Tfc2AMBZ8

Note: It was working fine with Redactor I and angular-redactor plugin.

Is this a known bug or any setting required to make it work? Thanks.

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.