Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 20 13:48
    lsmith77 opened #1517
  • Aug 14 15:29
    reneklacan commented #1497
  • Aug 13 14:07
    KrisMerckx opened #1516
  • Aug 09 02:19
    skarensmoll commented #543
  • Aug 08 22:32
    yickling commented #1503
  • Aug 07 20:53
    curthusting commented #1503
  • Aug 05 17:46
    stefanpejcic closed #1515
  • Aug 05 17:03
    bago2k4 commented #1459
  • Aug 02 22:53
    jkhaui commented #1513
  • Aug 02 19:17
    sb2059 edited #1515
  • Aug 02 19:17
    sb2059 edited #1515
  • Aug 02 13:32
    AlexNodex commented #1514
  • Aug 02 13:31
    AlexNodex commented #1514
  • Aug 02 13:28
    jkhaui commented #1514
  • Aug 02 13:00
    jkhaui commented #1513
  • Aug 02 12:58
    jkhaui commented #1513
  • Aug 02 12:50
    AlexNodex commented #1514
  • Aug 02 12:35
    jkhaui commented #1514
  • Aug 02 06:51
    sb2059 opened #1515
  • Jul 29 15:48
    stefanpejcic labeled #1488
Nate Mielnik
@nmielnik
@Hazantip I'm not sure I understand what you're asking exactly, do you have some sample code you can share that shows the case where you're looking for the action?
Nate Mielnik
@nmielnik
@csarven did you make any progress with the issue you were describing? It seems like there might be some terminology confusion. Were you instantiating a new instance of medium-editor for the entire body of a webpage?
Sarven Capadisli
@csarven
@nmielnik yes, I was setting it on body and the textarea was within that. So, pasting into the textarea didn't work at all. So, I moved the textarea outside of body - it is a sibling of textarea (as awkward that probably is)
Hazantip
@Hazantip

@nmielnik my code sample at https://codepen.io/Hazantip/pen/GQKBYY
my buttons are RTL and LTR, but what i want, that undo changes on click 'removeFormat' button and 'removeFormat' is undoing all changes except these one which were done with RTL\LTR buttons.

So i think this should be great, if when i calling 'removeFormat' be able to call for my custom buttons this.classApplier.undoToSelection()

Nate Mielnik
@nmielnik
so what you had @csarven was an element within an editor that could receive focus (ie textarea) which means it could trigger events that I don't think medium-editor was expecting for elements within the editor
it's been quite a while since I looked at the code, but I know the code to detect whether the user has begun to interact with something outside the editor was very complicated (this is how it could know the hide the toolbar). Some things to try would be 1) stopping some of the events from the textarea for propagating up the DOM (ie focus, keyup, etc.) or 2) trying to put another element inside the body (ie a <div>) that would still hold everything but attach medium-editor to that instead of the entire body (since I believe medium-editor monitors events at the body by default, so setting <body> as the editor element could be causing some wonky stuff
Nate Mielnik
@nmielnik
I think a feature that could have helped you @csarven would be yabwe/medium-editor#180 where you could tell the editor to ignore certain elements, I doubt anyone tried to implement that over the past year or so though
@Hazantip I'm guessing you just want the removeFormat button to do something extra. In that case, you can just pass your own custom removeFormat button and have it do something special before calling the default behavior
Nate Mielnik
@nmielnik
you can create another custom button (like you did with the sample code you passed) and use the same default properties as the removeFormat button (https://github.com/yabwe/medium-editor/blob/master/src/js/defaults/buttons.js#L182-L188)
and in your handleClick method, do your custom code to remove the RTL/LTR button formatting, and then call this.execAction('removeFormat') which will do the exact same thing that the default removeFormat button would do
if you haven't seen already, the handleClick method for the default buttons is pretty straightforward https://github.com/yabwe/medium-editor/blob/master/src/js/extensions/button.js#L163-L172
the other option is when you're instantiating your editor, you can pass an override for the removeFormat button in via the extensions options (like you're doing for all your custom buttons)
except for removeFormat, you'd just pass an object with a single handleClick method, where you can define your own custom code which would execute when that button gets clicked
Nate Mielnik
@nmielnik
// ...
extensions: {
    'removeFormat': {
        handleClick: function (event) {
            event.preventDefault();
            event.stopPropagation();

            // Do your custom stuff to remove
            // the RTL/LTR buttons here

            this.execAction('removeFormat');
        }
    },

    // your other button definitions here...
}
// ...
I believe either of those should work, if all your trying to do is add some extra code to the removeFormat button
Sarven Capadisli
@csarven
@nmielnik Yes, ignoring would be helpful.. At first I thought adding contenteditable=false would help with that
Hazantip
@Hazantip
@nmielnik, thanks, i've extended removeFormat button constructor passing object with key 'handleClick' into edtiorInstance.toolbar.buttons
Hazantip
@Hazantip
button looks like
const removeFormat = {
            name: 'removeFormat',
            aria: 'remove formatting',
            action: 'removeFormat',
            contentDefault: '<b>X</b>',
            contentFA: '<i class="fa fa-eraser"></i>',
            handleClick: function (event) {
                    event.preventDefault();
                    event.stopPropagation();

                    // Undo default
                    this.execAction('removeFormat');

                    // Undo selection for all custom extension
                    const extensions = this.base.extensions;
                    const extensionsCustomOnly = this.base.options.extensions;

                    for (const key in extensions) {
                        const extension = extensions[key];
                        if (typeof extension.setInactive !== 'function') {    
                            continue;
                        }
                        if (typeof extension.classApplier !== 'object') {
                            continue;
                        }
                        extension.classApplier.undoToSelection();
                        extension.setInactive();
                        this.base.checkSelection();
                        console.log(`undo ${extension.name}`);
                    }
              }
      };
Hazantip
@Hazantip

Editor defaults

Is there is an option, to apply some actions initially to Editor? For example i want that all my text will be initially bold (do not propose use css on editor.)
Felix Tang
@tngflx
hi guys
i want to have a static toolbar as well as inline toolbar
is it possible to do that?
Arsalan Khalid
@arsalankhalid
Anyone familiar with how to approach sizing the whole editor, getting it into a form rather than the full page, the way it is now
just trying to start off with trying to figure out how to resize it, anyone able to redirect me towards something?
Felix Tang
@tngflx
channel is dead :(
AtomHeartFather
@AtomHeartFather
ello
Ayaz Uddin
@Ayaz2589
Hey everyone, is there a way to create code blocks into the medium-editor?
sloan-dog
@sloan-dog
@Ayaz2589 I'm interested in helping maintain
Jérémy Benoist
@j0k3r
@sloan-dog You should ping @nmielnik instead
Sarven Capadisli
@csarven

@sloan-dog @j0k3r @nmielnik FWIW: in the https://github.com/linkeddata/dokieli project, we use medium-editor.. but considering to switch to something else because of lack of dev activity in ME. Don't take this as criticism :) I decided to use ME awhile back because it hit the right boxes for dokieli's needs - also ME dev was quite active at the time. There are however some important issues IMHO - don't we all? - that makes it hard to work with or extend ME. From dokieli's POV, we just want to reuse an existing library as much as possible.. and the core of it need to be quite stable. We're not in the "business" of developing our own editor so counting on what the smart/hardworking folks are doing out there. I still think ME is great but it may be aging.. so if it gets picked up again, that'd be great. I don't know if there are fundamental shortcomings of the ME architecture that would make it more reasonable for a rewrite or whatever - this is something you folks know better. FYI recent discussion re the switch starts here: https://gitter.im/linkeddata/dokieli?at=5cb0caffbd70a40d5f3bd5ef . Note:

We need to factor in: regular WYSIWYG-like editing [..], collaborative-editing, versioning-friendly?, extensible for different forms of annotations (like RDFa embedding, Web Annotation..), active dev community

Happy to give further feedback. IIRC, I've already logged issues we've faced in ME GitHub issues and in dokieli's issues (search for ME or editor perhaps if of interest)
Jérémy Benoist
@j0k3r
Thanks for the kind words @csarven I think a lot of projects are using ME but we (@nmielnik and me) are no longer available to keep the project updated. I personnaly don't use it anymore in my current job and don't have enough spare time to maintain it during my free time.
Nate Mielnik
@nmielnik
thanks @csarven ! That all makes sense to me, my shortcoming was not trying harder to recruit & hand off the project years ago (I've actually done a talk about this exact topic). I'm not sure what the chances are of someone being willing to pick it up....but if no one does I can definitely empathize with not wanting to rely on it.
Carlos Guerrero
@guerrerocarlos
Hello @nmielnik happy to help over here!
I am working on a "github-integrated" editor called qinab.com that uses mediun-editor heavily, so since I am getting to know all the code anyway, happy to help with the project as well. @nmielnik
Shreyan Mehta
@duke7able
hello , I have worked on custom context-menus like this , i would be happy to help to contribute and maintain this repo
Dilantha
@dilantha111
Hi I work as a Full stack developer most of my experience are in java script, I would be happy to help
JasonSeah
@Jasonseah
Hi, would love to help in this amazing WYSIWYG library please do let me know how and what to help =D
wiredmartian
@wiredmartian
I'm interested a contributor to the project :)
Zhu Liang
@paradite
hey @nmielnik , i'm interested in helping to maintain the project. i built a small feature for ME before and helped with answering issues, if you still remember. and i really admire what you guys have achieved so far, so i don't want to see all the efforts go abandoned.
Bechir Ahmed
@BechirAhmed
Hey @nmielnik , thanks for your huge effort, i use this amazing WYSIWYG editor in my personal projects and i'm interested in helping to maintain it
Nate Mielnik
@nmielnik
@Jasonseah @wiredmartian @paradite @BechirAhmed apologies, my gitter notifications got screwed up
thebugzapper
@thebugzapper
Hi guys, I will help with this
Jiue-Ren Liao (Rick)
@xrick
Hi, everyone
I am seeking an easy tool to write medium articles, any suggestion?
Stefan Pejcic
@stefanpejcic
Hello everyone, the unofficial WordPress version can be found on: https://github.com/PluginsBay/Medium-Editor and soon on wp.org
Anyone that uses WordPress nad wants to help/contribute is welcome.
@nmielnik I'd also like to get involved in maintaining/collaborating
Nate Mielnik
@nmielnik
Awesome @stefanpejcic i'll add you to the repo now
Stefan Pejcic
@stefanpejcic
thanks @nmielnik great to be here