Giter Club home page Giter Club logo

trumbowyg's Introduction

Downloads Downloads Licence
Version on npm CDNJS Version on bower

Supporting Trumbowyg

Trumbowyg is an MIT-licensed open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing. You can support its ongoing development by being a backer or a sponsor:

Sponsors

Gold

avot®

Become a Sponsor

Silver

SocialOptic

Become a Sponsor


Introduction

Trumbowyg is a simple and lightweight WYSIWYG editor, weight only 20kB minifed (8kB gzip) for faster page loading.

Visit presentation page: http://alex-d.github.io/Trumbowyg/

Documentation

All you need to know about Trumbowyg is here: http://alex-d.github.io/Trumbowyg/documentation/ (or even on the home)

Contribution

You can contribute to Trumbowyg with translations in languages you know. Thanks to node and gulp, you can improve core script, style or icons easily.

First, fork and clone the repository

cd Trumbowyg # go into the project's root directory
npm install # install development dependencies
npm run dev # watch mode
npm run build # to build the project

gulp command launch default Gulp task watcher and rebuild on the fly.

Stay in touch

For the latest release and announcements, follow on Twitter: @AlexandreDemode

License

This project is under MIT license.

trumbowyg's People

Contributors

absalomedia avatar alex-d avatar blufish avatar civile avatar degj avatar dhiemstra avatar droeftoeter avatar edwinveldhuizen avatar fahrim avatar flokx avatar forelabs avatar housealwayswin avatar inavitski-sc avatar johonunu avatar m-a-x-s-e-e-l-i-g avatar meekohi avatar mnico avatar nurogenic avatar ozgurg avatar piemp avatar ra100 avatar realulim avatar sdrack avatar sduck4 avatar svoboda-jan avatar timint avatar twilightcoder avatar urosg80 avatar veeenex avatar zanechua 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

trumbowyg's Issues

Removing br tags in Semantic Mode

The semantic mode is pretty sweet, but it was removing all the br tags,
I added a function to replace the br tags with p tags.

sementicCode: function(force){
    this.syncCode(force);

    if(this.o.semantic){
        this.sementicTag('b', 'strong');
        this.sementicTag('i', 'em');
        this.sementicTag('strike', 'del');

        this.paragraphTag(); // Added this function
        this.removeTag('br');

        this.$e.val(this.$editor.html());
    }
},
paragraphTag: function() {
    this.$editor.contents().filter(function() {
        return this.nodeType == 3;  // Only text nodes
    }).wrap('<p></p>');
},

[NFR] Implement "blur" event

Hi Alex-D,

Thanks for trumbowyg, it rocks!

Would it be possible to introduce event handler for the case when user clicks outside WYSIWYG area?

I would like to be able to fire "save" event manually.

Cheers!

Problem with accents

I can't type words with accents in my editor. It prints the letters without the proper accent.
Is there any way to set a charset for my lang file?

Strange cursor behavior when tying in textareas

Great editor, but am experiencing the strangest bug. It's fairly easy to replicate. I found this after I downloaded the package and started evaluating the demo.

  1. Remove all default content from the demo textarea.
  2. Start typing

What you may notice is that the cursor doesn't continue typing a line as you'd expect. Instead, you get something like this (I copied the following text exactly as it appeared in my editor):

W

h

y

is

th

i

s

e

di

t

or

do

i

n

g

 t

hi

s

NOTE: This behavior DOES NOT happen in the examples that are pure divs with contenteditable enabled. It ONLY happens in the textareas (i.e., marked with the standard <textarea> tag). I have confirmed this behavior in the latest versions of Chrome and Firefox.

In IE, things get a little stranger (no one should be surprised). The pattern example I listed above continues for a few lines and then about six lines or so in, the typing returns to normal, meaning I can type a continuous line of text just as you'd expect in any editor.

Now, when I peek at the raw code within the textarea, this is a sample of what's being generated:

[Sorry, github markdown is not playing nice with me for some reason. What was supposed to appear here is that every line break above is caused because of how paragraph tags are wrapping - like around one or two characters at a time]

I suspect it has something to do with the editor function responsible for wrapping nodes, but I'm not sure. It seems that whatever this function is doing works great in the divs but not so much in the textareas.

Paragraph separator div instead of p

Hi,

I'm using this fantastic plugin but I have one question.

When I hit ENTER key and then I choose the editor view, the paragraphs are enclosed in <div> instead of <p>

Any idea how to solve it ?

Thanks

Paste without formatting

Hello

We like this WYSIWYG editor and it lacks only 2 options.

  1. Paste without formatting
  2. Remove formatting button in toolbar

Can you add these so that we can actually use it ? We need this feature as a lot of our users are going to copy-paste stuff in this editor from word files / web but we need to save it as text without formatting.

Not working on Mobile and Tablets

Hi,

I just implemented your editor and it works pretty sweet, thanks! I noticed that it doesn't work on several devices:

  • iPad Mini Retina (iOS 7.0.4)
  • iPad 3 (iOS 7.0.4)

It does work fine on these

  • iPhone 4 and iPhone 5s (iOS 7.0.4)
  • Nokia Lumia 520 (Windows Phone 8.0)
  • Microsoft Surface 2 (Windows RT 8.0)
  • Asus Nexus 7 (Android 4.4.2)

Mobile
It does seem to work better with mobile: false (default), as soon as i set mobile to true, it seems to break and just show the default textarea.

Tablets
Just noticed that the same things goes for the tablets. When i turn the tablet support off (tablet: false) it works on the iPads i mentioned before.

Any thoughts on this?

Pasting leads to "apple-" span tags

DISCLOSURE: I'm evaluating editors for use by heavy-duty writers (novelists) who will do very evil things like copy and paste from Word. I'm testing the paste behavior of this editor very carefully because of the types of end-users it will be subjected to.

I noticed when copying and pasting from Word that the source code generated within the editor contains the "apple-" span tags. I've never seen this before in any of the other WYSIWYG editors I've evaluated. Not sure what is triggering this behavior, and this is happening in Chrome, Firefox AND IE (hard to believe those three editors are consistent on ANYTHING).

TO REPLICATE:
Copy and paste anything into the editor - pasting from Word is a GREAT stress test. Then, look at the raw HTML code. It doesn't matter if the underlying structure is a textarea or div, the results are the same - you will have text peppered with "apple-" span tags.

Once these issues are more sorted I can then focus on porting my Word Cruft remover functions. :)

[Suggestion] October CMS Usage

Great addition to the October Plugins :)

In the fields.yaml for posts etc, also comment out the "preview:" section, as this will remove the "edit" tab which will no longer be in use - might be worth adding this to the docs also :)

plugin translation

Hi Alex,

is it possible to use the main translation file for plugin translation? In the moment you have to translate every plugin file. Wouldn't it be easier to extend the main translation file?

Trumbowyg RubyGem

Hi Alex-D. I've forked your repository and created a Rails engine RubyGem out of it.
I took a few shortcuts since it's a first (skipping Compass dependency, for instance.)

I would like to do it more properly - as in easy upgrade from your repo, if we could find a meaningful approach for us both.

Would you take a look? https://github.com/ringe/Trumbowyg

Image Upload

Hi,

I've seen that you were trying to add an image upload plugin. So you have to put a PHP file on your server, configure it, etc ...

Is it possible instead to stay in HTML5 ? Imagine a drag/drop file upload, just adding a base64 URL in the HTML. No upload needed, no PHP needed.

No indication on the button pane which formatting is selected

When a formatting is selected by pressing button from the button pane (Bold, Italic, Unordered list, Ordered list), there is no indication which formatting is selected. The button is not darkened or changed in some way showing the selected formatting(s).

Fullscreen mode breaks bootstrap modals

Hi Alex,
First off - great work! I have been playing with trumbowyg for the last few hours and it looks very, very promising. I can't believe I have never heard of it before.

One little problem I noticied - the fullscreen mode doesn't play nice with bootstrap modals:

  1. Open a bootstrap modal with an editor in it.
  2. Start fullscreen mode (the editor sets the inline style="overflow: hidden;")
  3. Stop fullscren mode (the editor sets overflow: auto;)

After the 3 step the modal is broken and the user scrolls the body instead of the modal.
As a suggestion - maybe the editor can check if the overflow of the body is already set to hidden, before trying to set it.
And using a class to set the overflow would be better, because clearing the overflow:auto from the inline style="" is not that trivial and this means that until the next page reload all modals will be broken.

What do you think?

Insert image or link - JS error is thrown when page uses jQuery validation

I am using your plugin (BTW, great work) on a page that also uses jQuery validation. Every time when I want to add link or image (pop-up appears), JS error is thrown "TypeError: c is undefined" and jQuery validation is referenced.

I have validated that erros are not thrown when page is not using jQuery validation.

Edit: still works, error does not prevent from further using.

Link insertion doesn't work

If you try to insert the link using editor when there is no text selected (when area is empty or there is a new line), then nothing is happening and no link is inserted.

This only happens with FireFox browser on Windows or Iceweasel on Linux, so this might be a browser specific issue.

Tested on FireFox v30.0 and Iceweasel v24.6.0.

Can anybody confirm that this problem exists? And is there a way to fix this problem?

Regards,
-Vytautas

API to empty content?

It looks like no API to empty content?
Please ignore this if there is one...

I've put in a small function in my copy:

empty: function(){
    this.$e.val('');
    this.syncCode(true);
},

german translation

here you find a german translation

$.trumbowyg.langs.de = {
viewHTML: "HTML anzeigen",

  formatting: "Formatieren",
  p: "Absatz",
  blockquote: "Zitat",
  code: "Code",
  header: "Überschrift",

  bold: "Fett",
  italic: "Kursiv",
  strikethrough: "Durchgestrichen",
  underline: "Unterstrichen",

  strong: "Wichtig",
  em: "Betont",
  del: "Gelöscht",

  unorderedList: "Ungeordnete List",
  orderedList: "Geordnete Liste",

  insertImage: "Bild einfügen",
  insertVideo: "Video einfügen",
  link: "Link",
  createLink: "Link einfügen",
  unlink: "Link entfernen",

  justifyLeft: "Links ausrichten",
  justifyCenter: "Zentrieren",
  justifyRight: "Rechts ausrichten",
  justifyFull: "Blocksatz",

  horizontalRule: "Horizontale Linie einfügen",

  fullscreen: "Vollbild",

  close: "Schliessen",

  submit: "Bestätigen",
  reset: "Abbrechen",

  invalidUrl: "Ungültige URL",
  required: "Benötigt",
  description: "Beschreibung",
  title: "Titel",
  text: "Text"

}

ie8/ie9 browser support for upload plugin

Have you looked into making the upload plugin friendly to <IE10 browsers? I can see two immediate issues to be solved.

The first and easiest, allow for a fallback in browsers that can't do multiple file uploads:

                            try {
                                // Multiple files allowed, we just get the first.
                                file = ev.target.files[0];
                            } catch (err) {
                                // In ie8, multiple files not allowed
                                console.log(err);
                                file = ev.target.value;
                            }

Second issue: getting the file from the file input to the $.ajax call with something in addition to/other than the FormData() object. I'm a little stuck on this one...

Cursor is moving left after selecting formatting and no formatting applied

EDITED by the repository Owner (@Alex-D) : duplicate of #62

  1. Start typing a text
  2. Select Bold or Italic
  3. Type a character

Expected:
All signs typed from here are in the chosen formatting

Actual:
Only the first sign is in the chosen formatting. Then the cursor is moved before the last typed character and all the typing form here is done before this character and with no formatting

Tested on Chrome, Firefox and IE. In IE there is no such bug

Auto URL to <a> doing weird things

I am getting some bizarre results when I use the editor and just paste in a url without trying to link it.

Consider the following 'note' added using the editor:

First line
http://www.google.com
Last line

I am getting the following returned:

<div>
    <p>First line</p>
    <p>
        <a href="http://www.google.com&lt;/p&gt;&lt;p&gt;Last">http://www.google.com
    </p>
    <p>
        Last</a> line
    </p>
</div> 

Notice where the start and closing tags are... this is totally messed up.

Also is there a setting / option I can use to turn this off. Despite this rather annoying issue with it not making the hyperlink properly we don't want to have this feature unless we specifically make a link.

Table support

It would be great to have a table button for inserting tables, rows, and columns.

tab key within a form

Hi, I'm using your editor in a form. I really like it.
The editor is below other fields in the form.
A typical use of this form is fill a field, TAB to the next field, etc...
But when I press the TAB key in the previous field, the cursor jumps to the "bold" button at the toolbar.

Is there any way to skip the toolbar when pressing tab, and jump right to the textarea editor?

thanks!

Button panel doesn't show the current status

I am not sure it is a bug report or a feature request, but it would be nice if I could see the selected text's current status on the button panel (e.g.: if I bold the selected text and then I select it again the bold button is still off)

Horizontal Rule

'insertHorizontalRule' (mentioned in the documentation) didn't work for me. Then I changed it to the following and it worked fine.

var btnsGrps = jQuery.trumbowyg.btnsGrps;

$('.simple-editor').trumbowyg({
btns: ['viewHTML',
'|', 'formatting',
'|', btnsGrps.design,
'|', 'link',
'|', 'insertImage',
'|', btnsGrps.justify,
'|', btnsGrps.lists,
'|', 'horizontalRule']
});

After changing font style while writing cursor skips before style change

When I change font style (strong, emphasis) with button or keyboard shortcut cursor skips before the tag after few seconds/few letters. Or if I switch to strong, and write nothing, after a second style turns off. I hope picture will be more explanatory.
trumowyg
I tried Opera, Chrome, Firefox.

Free Color choose (html code)

Hi, I need to add a button to the dropdown color plugin to permit user to use a specific html color (ex : #FF0000).
I've modified the plugin buildDropdown function, if tou want to add this to the plugin :

  function buildDropdown(func){
  /* ... not modified : $.each ... */

    // add free color btn
    var btn = '_'+func+'_color_free';
    $.trumbowyg.opts.btnsDef[btn] = {
        func: function (params, tbw){
            tbw.openModalInsert( "Specific Color",{
                    html_value: {
                        label: 'HTML',
                    },
                },
                // callback
                function(values){
                    tbw.execCmd(func,values['html_value']);

                    return true;
                }
            );
        },
        text:'#',
        // style adjust for displaying the text
        style:'text-indent: 0px;line-height: 20px;padding: 0 5px;'
    };
    dropdown.push(btn);

    return dropdown;
}

BBCode?

Heyho, I like your WYSIWYG-Editor very much, I would use it, but there is no BBCode-Support :(
Is something like this planned?
Would be happy if this will be answered, thanks and good greetings from germany,

Tim

Is there an 'onchange' event?

I'm trying to show a live preview where a partial content is being edited in "Trumbowyg". I tried multiple events including keyup, change, twbfocus, twbblur but none give the desired effect. The keyup event works great when a user is changing something manually in the editor but nothing else works when editor's toolbar is used (i.e. some text made bold) until user types in something. Also, the "native" event (twbfocus, twbblur) examples here don't fire at all: https://alex-d.github.io/Trumbowyg/documentation.html#events

Is there a way to know when content in the editor was changed?

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.