Coder Social home page Coder Social logo

ckeditor / ckeditor5 Goto Github PK

View Code? Open in Web Editor NEW
8.7K 8.7K 3.6K 546.37 MB

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

Home Page: https://ckeditor.com/ckeditor-5

License: Other

JavaScript 36.73% Shell 0.01% HTML 11.93% CSS 0.60% Rich Text Format 35.18% TypeScript 15.55%
ckeditor ckeditor5 contenteditable javascript rich-text-editor rte wysiwyg wysiwyg-editor

ckeditor5's People

Contributors

annatomanek avatar arkflpc avatar ckeditorbot avatar cktravisbot avatar dawidurbanski avatar dumluregn avatar f1ames avatar filipsobol avatar fredck avatar godai78 avatar gorzelinski avatar illia-stv avatar jacekbogdanski avatar jodator avatar ma2ciek avatar mateuszzagorski avatar maxbarnas avatar mlewand avatar mmotyczynska avatar niegowski avatar oleq avatar oskarwrobel avatar panr avatar pomek avatar przemyslaw-zan avatar psmyrek avatar pszczesniak avatar reinmar avatar scofalik avatar szymonkups 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  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

ckeditor5's Issues

Make the dev version AMD only

I've been doing my best to try to make the dev version of v5 (the code in ckeditor5) in a way that it works out of the box in websites using CKEditor,in the very same way the build version would work. Essentially, we're talking about having the CKEDITOR namespace exposed and ready to be used.

The problem is that the CKEDITOR namespace is made by code present in several files in ckeditor5-core which need to be downloaded before the namespace gets ready. So, to do it, we limited the number of features in CKEDITOR on startup, extending it asynchronously while loading core.

Now I'm working on #3, to introduce CKEDITOR.create(). Here again, we would have to have a fake create() function that would just save the creation call to be really executed just later, when core is loaded. We do this in v4 and it "works", but it's a mess and the code is dirty.

To make it worst, we would like create() to return a Promise, which is a class from core. So, if core is not available, we would have to return something the looks like a promise and so on... more dirty and unclear code.

Therefore, I think we're going to the wrong direction.

In short, we're not able to make the CKEDITOR namespace work right with the dev version, so we should make it AMD only.

In any case, we require RequireJS to run dev code. So we'll always have AMD in place.

This means that, when using the dev code, one should always do something like the following:

require( [ 'ckeditor' ], function( CKEDITOR ) {
    CKEDITOR.create( ... );
} );

Then, the build version will offer the CKEDITOR namespace as well, but we'll not have it in the dev version.

I need a confirmation for this so I can work on this change.

Unify some assertion styles in the tests

This topic was already discussed at the very beginning of CKEditor5 implementation, but I still can find some tests using "wrong" syntax.
As we talked here we've chosen to use expect(A)to.equal(B) over expect(A)to.equals(B) that produces a grammatically incorrect sentence. We should review all the existing tests having that in mind.

Operation builder

It should be possible to bold part of the document using simple command in JavaScript console:

var builder = new Builder( document );
builder.addAttribute( range, bold );
builder.modification.render();

To do so, Builder and Modification classes should be created. Modification is a set of transactions with additional information about changed nodes.

Introduce the Mixin class

Following recent talks, to make the use of mixins more elegant, we should introduce the Mixin class.

The following is a usage example of it:

var EmitterMixin = new Mixin( {
    method1: ...,
    method2: ...
} );

function TargetClass() {}

EmitterMixin.mixin( TargetClass.prototype );

The constructor basically accepts the mixin properties and the class exposes a single mixin() method to mix such properties in a target.

Handle typing

When user type in the editor changes should be applied on the document model. To do so mutation observer have to be implemented.

Introduce the first "creators"

The basics for the following creators should be introduced:

  • Inline Editor Creator (ckeditor5-plugin-inlinecreator)
  • Classic Editor Creator (ckeditor5-plugin-classiccreator)

The minimal expected features:

  • Make the minimal necessary DOM manipulation expected by the creator.
  • Load input data from the source element.
  • Initialize the root editable.
  • On destroy:
    • Revert the initial DOM manipulation.
    • Set output data back to the source element.

Parent should be a model property

Changes introduce in https://github.com/ckeditor/ckeditor5-core/pull/27 adds parent attribute as an editable property. I believe we should go deeper and add parent to the Model. If the parent is set it means that:

  • all events will bubble to the parent,
  • child models listen on parents destroy event and call theirs destroy functions/events if parent is destroyed,
  • the parent can be passed to the config so the child config will use the parent config, like editable do (this.config.parent = parent.config).

So:

editor.parent = CKEDITOR;
editable.parent = editor;
nestedEditable.parent = editable;

Thanks to this all events will bubble from editable to editor then to the CKEDITOR, the destroy on the editor will be passed to all editable, destroy on CKEDITOR will remove all editors and restore the original content.

If the parent is no set it will be CKEDITOR.

I believe that in this case one generic solution (parent in Model) is better then many separated (parent in editable, EditorConfig for bubbling config, adding destroy listener manually, bubbling events).

Plugins path resolution

The RequireJS "plugin" plugin must be created as well as the features to resolve CKEditor plugins paths.

Disable ckeditor with class

I don't know it is already answered but I can't find how to disable ckeditor with a class name given.

First, I replace all textareas using:

CKEDITOR.replaceAll();

Then, I what to disable all textareas that have disable class name:

<textarea class="disable" name="editor"></textarea>

How can I do that using class instead of its name?

Thanks!

Builder configuration

This topic reminds me why I wanted to reuse some of the existing grunt tasks for the build process instead of writing the builder task on our own... Right now there's no way to configure the build process from the Gruntfile. The only way to change anything (e.g. disable uglify during r.js optimization, change the output path etc.) is to play with the builder's source code.

Introduce the CKEDITOR.isDebug property

Related to https://github.com/ckeditor/ckeditor5-core/issues/38.

We need a property which will allow us to conditionally disable/enable some debug logs. For instance it could be used as follows:

if ( CKEDITOR.isDebug ) {
    if ( doSomeSuperUnnecessaryDebugChecks() ) {
        throw new CKEditorError( 'sth-broke: Kaboom!' );
    }
}

Later on we'll need to work on #27 to make it fully functional.

The idea here is that this isn't necessarily constant (as it might need to be switchable while debugging something) and that it's something different than already existing CKEDITOR.isDev (as we may want to build a debug version of CKEditor).

Builder should shorten log messages

Followup of https://github.com/ckeditor/ckeditor5-core/issues/38.

All usages of log.error(), log.warning(), CKEditorError() must be processed and the messages should be removed (only error names should be left). Additionally, we may decide to add some validation (may be built into this step) that error messages have the correct format.

Note: Theres' no support yet for placeholders in the error messages (they were mentioned in ckeditor/ckeditor5-design#14 (comment)). I don't think we must have, so I didn't want to unnecessarily complicate things.

Stable release date

Apologies if this has been answered elsewhere: I had a look and couldn't find it anywhere else.

Do you have an estimated date when a stable version of ckeditor5 will be available?

Define and explain the project schedule (ETA)

Keeping in mind that:

  • defining 1.0's ETA without explaining the scope of this release will be pointless,
  • we should release early and release often, what means that there will be smaller milestones and the solution will be usable in some specific, limited cases earlier than 1.0.0

we should define at some point (the sooner the better) a roadmap leading to the version 1.0.0. We should explain each milestone and what kind of stability and feature completeness we expect to reach at that point.

Document Model

Create a document model data structure. It should contains:

  • linear data,
  • document tree,
  • main document model class with applyTransactionapply method,
  • transactions operations.

Applying transactions should create or remove linear data and nodes.

Move `model` and `collection` out of the `mvc` directory

We understood that "model" is a basic concept in the API that relates to data in general. It reflects the API state.

While this concept participates in MVC, it is not exclusive for it, therefore it doesn't make much sense scoping it with a mvc directory.

Ofc, this applies to "collections" as well.

Introduce Model (MVC)

Independently of other MVC aspects, the first thing to get developed is the Model class, providing the basics for model data and observables.

Introduce implementation examples

The ckeditor5 repo should contain a set of examples of implementations. It has the purpose of both showcasing the different uses of CKEditor as well as being a tool to drive the development of all necessary features.

We predict the following implementations:

  • Forms: CKEditor used inside forms.
  • Inline: several editing spots in a document with the editor toolbar floating.
  • Inline Page: an app toolbar at the top which is used by CKEditor when editing spots in the page are focused.
  • Comments: CKEditor in use for comments in an article.
  • Single Line: rich-text editing on a single line.
  • Input: CKEditor used as a simple form input field (on steroids ;)).
  • Custom: A totally customized editor based on CKEditor.
  • E-Mail: CKEditor used to write e-mails.
  • Medium: A Medium-like editor.
  • GitHub: an editor that output GitHub's markdown with potential to replace the textareas used by GitHub on wiki and issues.
  • Stack Overflow: an editor that output Stack Overflow's markdown with potential to replace the textareas used by Stack Overflow.
  • Gmail: an editor with the same UI features available in the Gmail editor.
  • JQuery UI: an editor that uses JQuery UI as the UI library.
  • An example with the placeholder widget (used e.g. to display dynamic data from an external data set directly in the editor).
  • Twitter-like example.

This is an "umbrella issue". Every implementation should be handled on separate issues.

Numbered List Adds Items when switching from Source to Preview Mode

CKEditor 4 with the current Editor Options configured:

            language: 'en',
            uiColor: '#741275',
            allowedContent: true,
            removePlugins: 'image',
            extraPlugins: 'image2,uploadimage,colorbutton,table,tableresize,tabletools,dialogadvtab',
            filebrowserImageUploadUrl: '/scripts/uploadImage.php',
            colorButton_enableMore: true

Replicate:
Open Page
=> Add/Remove Numbered List
=> Add some items to the list

My test source:

<ol>
    <li>item1</li>
    <li>item2</li>
    <li>item3</li>
</ol>

In Source mode add some line breaks between items

Test Source now looks like:

<ol>
    <li>item1</li>
    <li>item2</li><br>
    <li>item3</li><br>
</ol>

Toggle between Source/Preview mode. CKEditor will start adding line breaks and list items

After 1 iteration Test Source now looks like:

<ol>
    <li>item1</li>
    <li>item2</li>
    <br />
    <li>item3</li>
    <br />
    <br />
    &nbsp;
</ol>

Keep toggling and it becomes

<ol>
    <li>item1</li>
    <li>item2</li>
    <br />
    <li>item3</li>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    &nbsp;
    <li>&nbsp;</li>
    <li>&nbsp;</li>
    <li>&nbsp;</li>
    <li>&nbsp;</li>
    <li>&nbsp;</li>
</ol>

Make .fire() return a promise

It would be interesting to have .fire() return a promise.

This would enable:

  • Listeners to throw errors.
  • Have asynchronous listeners (Yeah!!!)

Emitters would be able to do this (e.g.):

editor.fire( 'something' )
    .then( function() {
        // Do something on success.
    } )
    .catch( function( err ) ) {
        // Handle errors.
    } );

Create a document model on editors creation

When editor is created:

  • document model should be created (linear data + document tree),
  • editable data should be load, transformed to linear data, and fill document model,
  • document model should be rendered, so the filtered content will replace the original content in the editable element.

CKEDITOR._getBasePath() has insufficient tests

It may have 100% tests coverage, but this means that every statement is executed, not that every statement is correct. Since there's a pretty complex regexp used in which we already had bugs in CKE4, more tests are required.

Furthermore, we have good tests for this in v4. Why not porting them?

Builder should set CKEDITOR.isDebug to false and remove unreachable code

In https://github.com/ckeditor/ckeditor5-core/issues/38 we proposed couple of logging mechanisms, one of them being the CKEDITOR.isDebug property which can be used to wrap debug code.

         *      if ( CKEDITOR.isDebug ) {
         *          if ( doSomeSuperUnnecessaryDebugChecks() ) {
         *              throw new CKEditorError( 'sth-broke: Kaboom!' );
         *          }
         *      }

The builder should have an option (enabled by default) to set that property to false and also to remove unreachable code. The Uglify.js has a --define option which allows to preset some variable and then remove code that will not be reachable, but I'm not sure if it's going to work with an object property. If this will be a problem, then we can:

  1. Rename CKEDITOR.isDebug to CKEDITOR_DEBUG, but that would be ugly, as we also have CKEDITOR.isDev which could also be covered by a similar mechanism.
  2. Add our own extension to Uglify.js which will check this.

Confusing Model's variables naming (attribute vs property)

I've just like to let you know that differentiation between Model's property and attribute is not clear.
I get the impression that is a "potato, potato" problem - #26 (comment).
After talking with @pjasiun I get that attribute is a property that someone can listen to its changes.

This might give some problems:

  • Newcomers would have to read a documentation on in and remember which one is which.
  • For me attribute and property are synonims which other devs might found confusing - again one will have to remember which one use in which case.

Maybe giving attribute more meaningful name would make sense?
Ideally no docs should be needed or name would be connected to function so it will be easily remembered.

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.