Git Product home page Git Product logo

ice's Introduction

ice.js

Ice is a track changes implementation, built in javascript, for anything that is contenteditable on the web. Conceived by the CMS Group at The New York Times, ice is powering the editor used for writing articles in the newsroom.

Demo

Try it

Download

v0.5.0

Features

  • Track multi-user inserts and deletes with the option to turn on and off tracking or highlighting.
  • A robust API to accept and reject changes, get clean content, and add a lot of configuration.
  • Plugins for tinymce and wordpress.
  • Optional plugins to track copy-cut-pasting, convert smart quotes, and create em-dashes.

Get Started


Contenteditable initialization - If you are comfortable with maintaining your own text editing utilities, then you can initialize ice on any block element:

     var tracker = new ice.InlineChangeEditor({
       // element to track - ice will make it contenteditable
       element: document.getElementById('mytextelement'),
       // tell ice to setup/handle events on the `element`
       handleEvents: true,
       // set a user object to associate with each change
       currentUser: { id: 1, name: 'Miss T' }
     });
     // setup and start event handling for track changes
     tracker.startTracking();

Additional options:

     var tracker = new ice.InlineChangeEditor({
       element: document.getElementById('mytextelement'),
       handleEvents: true,
       currentUser: { id: 1, name: 'Miss T' },
       // optional plugins
       plugins: [
         // Add title attributes to changes for hover info
         'IceAddTitlePlugin',
         // Two successively typed dashes get converted into an em-dash
         'IceEmdashPlugin',
         // Track content that is cut and pasted
         {
           name: 'IceCopyPastePlugin',
           settings: {
             // List of tags and attributes to preserve when cleaning a paste
             preserve: 'p,a[href],span[id,class]em,strong'
           }
         }
       ]
     }).startTracking();

Useful utilities in the API:

acceptChange, rejectChange

     // Accept/Reject the change at the current range/cursor position or at the given `optionalNode`
     tracker.acceptChange(optionalNode);
     tracker.rejectChange(optionalNode);

acceptAll, rejectAll

     // Accept/Reject all of the changes in the editable region.
     tracker.acceptAll();
     tracker.rejectAll();

getCleanContent

     // Returns a clean version, without tracking tags, of the content in the editable element or
     // out of the optional `body` param. After cleaning, the `optionalCallback` param is called
     // which should further modify and return the body.
     tracker.getCleanContent(optionalBody, optionalCallback);

setCurrentUser

     // Set the desired user to track. A user object has the following properties: { `id`, `name` }.
     tracker.setCurrentUser({id: 2, name: 'Miss T'});

getChanges

     // Get the internal list of change objects which are modeled from all of the change tracking
     // nodes in the DOM. This might be useful to add a more sophisticated change tracking UI/UX.
     // The list is key'ed with the unique change ids (`cid attribute`) and points to an object
     // with metadata for a change: [changeid] => {`type`, `time`, `userid`, `username`}
     var changes = tracker.getChanges();

Tinymce initialization - Add the ice plugin to your tinymce plugins directory and include the following in your tinymce init:

      tinymce.init({
        plugins: 'ice',
        theme_advanced_buttons1: 'ice_togglechanges,ice_toggleshowchanges,iceacceptall,icerejectall,iceaccept,icereject',
        ice: {
          user: { name: 'Miss T', id: 1},
          preserveOnPaste: 'p,a[href],i,em,strong',
          // Optional param - defaults to the css found in the plugin directory
          css: 'http://example.com/custom.css'
        },
        ...
      });

Limitations/Dependencies

  • ice needs to be initialized after the DOM ready event fires.
  • Wordpress support is limited. We need contribution from any willing WordPress developers.
  • Browser support is limited to Firefox (5+) and Webkit browsers, and minimal support for IE8+.

Changelog

Master

  • Fixes bug where Webkit browsers were throwing errors when the letter "v" was pressed.

0.5.0

  • Fixes cut, copy, paste for Firefox and Webkit browsers.
  • Fixes delete tracking in webkit browsers.

License

GPL 2.0

ice's People

Contributors

benesch avatar bennettyates avatar delambo avatar johanneswilm avatar jrbl avatar lleirborras avatar nb avatar sae249833 avatar sanjayginde avatar skratchdot avatar tswicegood avatar unknower avatar willwbur 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  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

ice's Issues

track html editor events

I'm trying to integrate 'ice' with an html editor, such as ckeditor or tinymce. I would like to track changes made through the editor, such as bold, underline, bullet list, etc.

I figure it should kinda be similar to the handlePaste method in the CopyPastePlugin, except that I need to setup an event listener rather than listen to keydown. Any tips on how to do that?

Potentially support a more permissive license

The WP and TinyMCE plugs definitely need to be to GPL to be compatible with the respective software, as does all of the other code used, but have you considered releasing everything else with a GPL/MIT similar to that used by jQuery? I would love to look at possible integration with the @armstrong project, but a straight GPL license means we can't use this directly in Armstrong out-of-the-box.

Delete event issue

When I delete text inside a TinyMCE text area it gets deleted correctly and the change tracked but if I delete all the text (not just inserted) and hit DEL for the last time it deletes also the del ice span removing the info about the deletion.
It happens in Firefox and Chrome too with TinyMCE 3.5.8 and ice last version.

Removing ICE from elements

is there a way to cleanly remove ICE, the functional opposite of startTracking() in such a way that it can be reinitialized again?

e.g. 1. accept all changes, 2. turn-off track-changes, 3. remove contenteditable?

I can do #1 and #2 through the API, but I can't seem to figure out how to remove contenteditable...

Chrome: inserted spaces do not become tracked changes

In chrome, if you insert one or more spaces before any other characters, they don't become a tracked change. Once a change is "opened" by typing some non-space character, subsequent spaces are inserted into the running change.

fix Webkit (and Gecko) implementation fo contentEditable?

Unfortunately it seems as if in both Webkit and Firefox this area seems to have been abandoned a while ago. If you look at the files here: http://trac.webkit.org/browser/trunk/Source/WebCore/editing?rev=133820&order=name those are the Webkit files related to editing. Some of these seem not to have had any major editing for 6 years+ (only small patches from users here and there). I'm trying to get around some of the limitations in Javascript, but it's driving me quite insane.

For example, I am currently wrestling with these issues in Webkit:

-- It likes to throw font-elements into the code without being asked for it. Font elements are not part of HTML5 and were deprecated in HTML4.01. There are numerous similar problems like this one.

-- Spaces at the end of paragraphs that are in their own span element (or any other inline element) are not displayed(!) The quick fix for this is CSS code such as:

span::after {
content: '.';
font-size:0;
}

I found that simply by trying it out. It basically adds a period after each span element, and then changes the font-size of that period to zero, so that the users doesn't actually have to see it.

-- A contentEditable=false element inside a contentEditable=true is being deleted as if it were one single character when hitting Backspace or Delete, the way one would expect. However, if three elements are stacked into one another (contentEditable=true inside of contentEditable=false inside of contentEditable=true) and one tries to remove the middle one using the backspace key, somehow the innermost and outermost content-editable elements are fused in an uncontrollable way. The behavior I would expect would be for both inner elements to be removed.


The code around contentEditable seems never to have been finished completely. There are numerous messages saying things such as "FIXME: ... This was done to match existing behavior, but it seems wrong."

Now the question is: If neither Apple nor Google nor Adobe nor anyone else saw any reason to fix any of this since 2006/07, what chances are there that this will happen in the future? Currently it seems almost easier to reprogram the entire contentEditable functionality in Javascript than to rely on the implementation in Webkit. Alternatively, one could try to fix Webkit. My C++ knowledge is quite rusty and given the time it takes to compile Webkit it's not exactly something one would one to do by trying around.

So the idea: What if we instead of trying to make a ton of Javascript implementations to work around the issues there are, try to fix Webkit instead?

Johannes Wilm
[email protected]

Firefox: being "in" or "out" of a change depends on cursoring over a tag

If you cursor into a change from outside, the transition from being outside the change (seen e.g. by watching the accept/refuse change buttons) occurs at a different place than reversing course and cursoring out of the same change area. While this is clearly about where "point" lands relative to the change tag, that's nigh impossible to explain to non-technical users. (Note that this doesn't seem to happen in Chrome.)

Refactor core functions for better api

Some of the core objects in ice use the old JavaScript convention of marking non-api/private functions with an "_". We should refactor these functions out of the core prototype and into the outer closure so that they can only be referenced internally.

I'm not concerned with privacy - "we're all adults around here" - I just want to clean the api/proto of these functions.

delete of content by current user differs when selecting range and when deleting with backspace

If a user selects a paragrpah he previously wrote and hits the "backspace" key, it is crossed out. However, if instead he places the cursor at the end of the paragraph and presses "backspace", the paragraph is deleted letter by letter until completely gone.

If the pargraph has been crossed out by the first method, it can not subsequently be removed entirely with the second method.

This behavior seems inconsistent.

Observed in Chromium 22/Chrome 25/Firefox 18.

double deletion of content results in real removal

If you select a few words in the second paragraph oif the text editor and hit remove, they are crossed out with a blue line. If you then mark all three first, second and thrid paragraph and hit enter, all three paragraphs are crossed out. However, the few words you marked as deleted in the beginning are now entirely gone.

I have fixed this in johanneswilm@fe6cf38

code duplication?

It seems as if there is some functionality that is present twice inside deleteFromRight and deleleFromLeft. Compare for example lines 869 and 936-937. It seems like there was a plan with stub elements once, but that code now no longer is executed.

I have removed the extra code and reimplemented deletion of stub elements (such as images) in my commits from yesterday and this morning.

@delambo question: I have implemented tracking deletion of stub elements in a function called _addNodeTracking: https://github.com/johanneswilm/ice/blob/master/src/ice.js#L1167 . I want to also add functionality to make it track addition of such elements. But how do I access this call from outside? Say I have created an image with my text editor (tinYMCE, Aloha or whatever), and I now want to tell ICE that it should add this image node to the current user as a new node. What call do I use?

IE8 compatibility

Need to include something like the following to support css styles on and tags

<!--[if lt IE 9]>
<script>
    document.createElement('insert');
    document.createElement('delete');
</script>
<![endif]-->

Rearranging content via dragging does not trigger changes.

When rearranging text content via dragging a selection of text, the tracker does not detect the changes.

Steps to reproduce:

  1. Take a given set of text within a contenteditable section that has an initialized tracker.
  2. Select one or more pieces of text within the section.
  3. Click and drag the highlighted piece of text to another area of the section.
  4. Unclick.

Expected behavior:

  1. The editor should respond on the mouseup event and track the change that has occurred.

Actual behavior:

  1. ...

crash if blockEl appears at a higher level in the DOM

Assume that you have set

blockEl: 'div' (standard in Webkit)

with a document structure such as this:

A paragraph of the contents...
Another content paragraph...

Now in the function _deleteFromLeft, the parentBlock will potentially be assigned to an element outside of this.element in this line:

var parentBlock = ice.dom.parents(range.startContainer, this.blockEl)[0]

If the user now hits backspace at the start of a line, the container div will be deleted.

Use on other post types

if i change ice.php line 41 from:

if ( 'post' != $current_screen->id )

to

if ( 'post' != $current_screen->base )

the buttons appear properly in my pages (and i presume in CPTs if i had any) and seem to save revisions. haven't used it long enough to fully test out.

i read the inline comment that says " supporting this in other editor instances would require more post-processing" so i am curious as to what this additional processing is. from WP's perspective aren't pages and posts (And other CPTS) treated pretty much the same with the different 'post_type' in the database?

ice always grabs focus

When using ice as a plugin with tinymce, the textarea always grabs focus. I have tried initializing tinymce with both:

tinyMCE.init({
...
auto_focus:"",
...
});

and without, and neither work

backspace at start of line gives strange results in Webkit

Try the following (using a Webkit browser):

  1. Go to http://nytimes.github.com/ice/demo/
  2. In the first demo, scroll down to "But in reality it is..."
  3. Insert three new paragraphs above it. Each one of no more than a few lines
  4. Put your cursor at the end of the last paragraph you create in 3.
  5. Hit the Backspace key until they entire paragraph is gone and the Backspace key is at the start of the line.
  6. Hit Backspace one more time.

Expected results: The cursor should delete the now empty paragraph and move to the paragraph above it where it should be placed at the very last position.

What happens: Instead the "B" of the paragraph below it is deleted (the one that goes: "But in reality...").

In Firefox this works fine.

Writing for the end of an ins/del "expands" that ins/del even with track-changes off

We just implemented ICE on our project, and so far it's fantastic. But I also just noticed the following bug.

Environment:

  • TinyMCE
  • ICE v 0.4.1
  • Chrome/Safari/Firefox

How to reproduce:

  1. Turn of track-changes and write some text
  2. Turn on track-changes and write some more text
  3. Turn off track-changes and without moving your cursor, write more text
  4. See that the text written at step 3 is now also an "ins" change

Should have been:

The text written at step 3 should have been "normal" text and not within a "change".

Enter key at end of paragraph splits tracking nodes

This problem was first discussed in #40.

I'm trying to remedy this problem by intercepting an ENTER keypress and moving the range outside of any change tracking tags. Unfortunately, webkit moves the range back into the tracking tag before it takes action, splitting the tag into the new paragraph.

CC @johanneswilm

Additions are not tracked?

I feel as if perhaps I'm doing something stupid here, but I can't seem to get trackChanges() to report additions.

I've put together a Fiddle to reproduce this; if you type something in the editor and then cause it to lose focus by clicking anywhere else in the frame, you won't see anything added to the changes list; however, if you delete something and then blur it, you will see deletion events:

http://jsfiddle.net/obeattie/a7zhJ/1/

insert inside insert (Firefox and Webkit)

How to reproduce:

  1. Go to http://nytimes.github.com/ice/demo/
  2. In the first example, scroll down to the paragraph that starts "As a member of the 1%" (in green).
  3. Put the cursor at the end of above mentioned paragraph.
  4. Hit "enter" to start a new paragraph.
  5. Write something
  6. Check the DOM structure of the paragraph you wrote in 5: It will have an "insert" inside an "insert" with the outer insert representing the author from the paragraph above.

Reproduceable in both Webkit and Firefox, with and without TinyMCE plugin version

select deletion of own content

If a user selects and delete his own contents, this sometimes works and sometimes doesn't.

If it is part of a larger selection which also includes othr nodes, it works. If the user only selects all or part of a text he has written himself, it doesn't work.

I have a fix for this here:

johanneswilm@4abbcb6

In this line:

if (this._getNoTrackElement(elem) || this._currentUserIceNode(elem) || elem.nodeType === ice.dom.TEXT_NODE && this._currentUserIceNode(elem.parentNode))

It basically says as a third option "if the element is a text node, then check the parent element if it is an ice element of the current user.

h-elements, lists, images, other block elements

I have been working on support for lists, and images. Integration tests will still have to be written (will do some of that).
Also, it should be figuired otu how this would work with merge blocks. I am not exactly sure what the point is with merging blocks, but it would seem to me that merging anything else than p-elements with one-another, would not make a lot of sense, right? So if you have a list following a paragraph and you delete it all, the list and paragraph should not merge into one, right?

selection/caret events don't fire for keyboard events

There are three selection/caret related events:

  • caretUpdated
    Fires on keyup, range updated, and mousedown, range not yet updated
  • caretPositioned
    Fires on arrow key keydown, range not yet updated
  • selectionChanged
    Fires on mouseup, range updated

Problem: selectionChanged doesn't currently fire for keyboard events, and caretUpdated fires for a mousedown before the selection updates. I'm currently listening to both caretUpdated and selectionChanged, which results in some extraneous calls to the event handler on mousedown before the selection's actually changed.


Am I missing the original design philosophy? I think you could consolidate nicely like so:

  • selectionUpdated
    Fires on keyup and mouseup, range updated
  • selectionPositioned
    Fires on arrow key keydown w/ arrow key and mousedown, range not yet updated

avoid insert inside insert

hey,
while working on another project, I came across a discovery that works for Webkit:

in handleEnter, inside a Mongolian vowel space character (can be anything, but this one doesn't take any space:

        emptySpaceNode = document.createTextNode('\u180e');

Put it outside the insert, where you want the caret to be when the new paragraph is created.

        range.selectNodeContents(emptySpaceNode);
        range.collapse();
        selection = rangy.getSelection();
        selection.removeAllRanges();
        selection.addRange(range);

Now you can remove it again, but do it with a timer, so that the Enter is being executed first:

        function removeEmptySpace() {
            jQuery(emptySpaceNode).remove();
        }
        setTimeout(removeEmptySpace, 1);

I haven'ttried this in Firefox yet.

Uncaught ReferenceError: ice is not defined (tinymce plugin)

Hey there -

Brian @ ConsumerSearch here. We're looking to implement the ICE tinymce plugin in our Drupal CMS which is currently using TinyMCE.

I've merged the ICE code over our TinyMCE code, and configured our TinyMCE settings to load both the ice and icesearchreplace plugins on load.

However, when I load up a page to edit, I get the following javascript error:

Uncaught ReferenceError: ice is not defined in /libraries/tinymce/jscripts/tiny_mce/plugins/ice/editor_plugin.js:85 ed.addCommand.insert

Does ice get defined in an external file/function that I need to include outside of tinymce? If so, can you specify which files are required to include in order to get the tinymce plugin working?

When I view the demo I see the following files included:

    <script type="text/javascript" src='../lib/rangy-1.2/rangy-cssclassapplier.js'></script>
    <script type="text/javascript" src='../lib/rangy-1.2/rangy-selectionsaverestore.js'></script>
    <script type="text/javascript" src='../lib/rangy-1.2/rangy-serializer.js'></script>
    <script type="text/javascript" src='../src/ice.js'></script>
    <script type="text/javascript" src='../src/dom.js'></script>
    <script type="text/javascript" src='../src/icePlugin.js'></script>
    <script type="text/javascript" src='../src/icePluginManager.js'></script>
    <script type="text/javascript" src='../src/bookmark.js'></script>
    <script type="text/javascript" src='../src/selection.js'></script>
    <script type="text/javascript" src='../src/plugins/IceAddTitlePlugin/IceAddTitlePlugin.js'></script>
    <script type="text/javascript" src='../src/plugins/IceCopyPastePlugin/IceCopyPastePlugin.js'></script>
    <script type="text/javascript" src='../src/plugins/IceEmdashPlugin/IceEmdashPlugin.js'></script>
    <script type="text/javascript" src='../src/plugins/IceSmartQuotesPlugin/IceSmartQuotesPlugin.js'></script>
    <script type="text/javascript" src="../lib/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript" src="../lib/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>

Are all files required for TinyMCE usage?

Webkit paste broken

To reproduce:

  1. Go to nytimes.com
  2. select all (CTRL+A) and copy (CTRL+C)
  3. go to the demo editor (first one, not tinymce plugin)
  4. hit paste

You will observe that the entire page is pasted with nothing stripped out. In the Javascript console you will see a lot of error messages.

Tested on Chrome 26.0.1386.0

Odd issues with insert/delete when editing new content

While editing using the TinyMCE plugin and with track changes enabled, I'm noticing some strangeness whenever I try to change text that I've already added in the same session. The new text gets wrapped with an insert tag and highlighted in green. But let's say a minute later I want to change a word within the previous sentence. I highlight the word and type my new word to overwrite it, but instead both the old word and new word get wrapped with a delete tag.

Here's a link to a quick screencast that illustrates the issue:

http://dl.dropbox.com/u/16531332/Screencasts/ice-rangy-issue.swf

Selection delete bug

Internally, our QA found a selection delete bug in some of the recent changes on master. To replicate (start and end range marked by "|"):

<em><SAME_USER_INSERT>te|xt</SAME_USER_INSERT> text</em> te|xt

Delete and notice the error in the log, and all of the text is removed/not tracked.

Inline commenting

Any plans for supporting document commenting in the roadmap? Although you can't strictly classify such a feature under "track changes", while editing a document, you often have the need to add annotations/comments.

In latest version of WordPress, suppresses image insertion window

In WordPress 3.3.2, the plugin, when active, does not allow the user to work with the insert media functionality. When the button is pressed a div is created to fade out the content and present the insertion window, but the media window never appears. This occurs in Visual, HTML and Full Screen editors.

White space insertion and deletion

I noticed a bug that is also present in the tinymce text area in the demo page:
http://nytimes.github.com/ice/demo/

If you type more white spaces after a word it doesn't write theme and there is only one sapcein text area. That would be ok but if I press space bar 20 times I still have to hit DEL 20 times to erase invisible white spaces.

Compatibility issues with jQuery 1.3.2 - is there a minimum version requirement

Hey there -

I'm noticing some issues when using ICE with TinyMCE under jQuery 1.3.2. Most obvious issue is what appears to be with Rangy, in that the selecting text and typing to replace doesn't work as intended. The text to be overwritten remains as normal text (doesn't contain the .del class) and the new typed text appears as new text highlighted with the .ins class.

Using jQuery versions 1.4 and above resolves the issue, but this causes other breakage in our CMS (Drupal). Is there a minimum requirement for jQuery version for ICE?

I was also wondering if it would be possible to set up ICE to run in its own jQuery namespace so that if there is a minimum version requirement it could be run in jQuery's noConflict mode and we could include the newer jQuery library specifically for ICE, but still use jQuery 1.3.2 for our CMS.

A somewhat related question, is there a minimum version of TinyMCE that is required?

style information lost in TinyMCE (?)

we're using (and loving) the ice/track changes plugin for TinyMCE, but recently noticed
something odd.

whenever a user changes the text style information (text color, background color, font-size),
those changes are lost. in fact, viewing the html with TM's "html" button after changing the
style information for a group of words shows that a tag was placed around the words,
but the styling info was removed.

we really like this plugin, but without the ability to change styles, it won't work for our needs.

any input would be greatly appreciated.

robert meyer.

Deleting first line when empty, removes <p> element

We're currently looking at using ICE in one of our apps, but while testing, I noticed that when there is only 1 line of text in the content editable area, and the user deletes all characters, positioning the cursor at the beginning of the line (right against the

element), if the user hits 'delete' one more time, ICE will also delete the

element.

I trace the issue to ICE.js line 964. This line is doing the following:

range.setStart(prevBlock, 0);

However, when there is only 1line of text, the 'prevBlock' variable is null (because there is no previous block), which makes the code throw the following exception:

Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 rangy-core.js:2097

I'm going to attempt to fix this problem, but, I was wondering if you were aware of this issue, or perhaps is something I'm doing in my code that's causing this.

Any information will be much appreciated,
Thanks
Pedro

deleting in tracked mode removes paragraph breaks

When deleting in tarcked mode, holding the backspace key pressed and deleting the contents of entire paragraphs, the line breaks between paragraphs are deleted entirely.

Observed in Chrome 25 and Firefox 18.

Can't Delete From Lists (Bullet or Numbered)

There appears to be a bug in the way the plugin handles numbered and bullet list. Use of the plugin makes it impossible to delete the number/bullet from the list, only the content is deleted.

i.e.

  1. item 1
  2. item 2
  3. item 3

Deleting 2 results in:

  1. item 1
  2. item 3

The “2.” can’t be deleted.

Lost getCurrentRange() in IE 7->9

Hello,

I´m using ice.min.js in tinymce editor and i have follow Problem.

In IE 7->9 is range (variable) from getCurrentRange() (ice function) in discussion (plugin function) empty,
but in over browsers its all fine.

I use a ctools ajax popup function in drupal to add comment to my comment modul
and eval per ajax the discussion function for current Range Text.

When i click on Textarea in my ajax popup (div overlay) lost ice the current range (in tinymce textarea)
and i can´t add a text discussion.

I hope you can understand me and help me ;-)

mfg, Blacki

ICE plugin in worpdress frontend editor?

Hi,

I'm successfully using the ICE Wordpress plugin (v 1.0) and would like to know if it's possible, and how, to get the plugin working with the frontend editor (using wp_editor)?

The ICE plugin mce controls do appear in the tinymce editor on the frontend when using wp_editor, so it's being loaded, but all of the functionality when editing has been lost, (http://wordpress.stackexchange.com/questions/71952/integrate-ice-plugin-into-frontend-wp-editor).

Any ideas/help would be greatly appreciated.

initializeEditor doesn't recognize custom changeTypes

Relevant code in the initializeEditor attached below. When a custom changeType is added via addChangeType, those elements are not automatically parsed. Seems relatively easy to recognize any element in the changeTypes array (rather than hardcoding ins/del), unless this is something intentionally left to each plugin?

var ins = this._getIceNodeClass('insertType'), del = this._getIceNodeClass('deleteType');
    ice.dom.each(ice.dom.find(this.element, '.'+ins+','+'.'+del), function(i, el) {
        var styleIndex = 0;
        var ctnType = '';
        var classList = el.className.split(' ');
        for(var i = 0; i < classList.length; i++) {
            var styleReg = new RegExp(self.stylePrefix + '-(\\d+)').exec(classList[i]);
            if(styleReg) styleIndex = styleReg[1];
            var ctnReg = new RegExp('('+ins+'|'+del+')').exec(classList[i]);
            if(ctnReg) ctnType = self._getChangeTypeFromAlias(ctnReg[1]);
        }
        var userid = ice.dom.attr(el, self.userIdAttribute);
        self.setUserStyle(userid, Number(styleIndex));
        var changeid = ice.dom.attr(el, self.changeIdAttribute);
        self._changes[changeid] = {
            type: ctnType,
            userid: userid,
            username: ice.dom.attr(el, self.userNameAttribute),
            time: ice.dom.attr(el, self.timeAttribute)
        };
    });

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.