Code Monkey home page Code Monkey logo

Comments (27)

janwirth avatar janwirth commented on April 19, 2024 3

Done!
https://github.com/FranzSkuffka/vue-medium.js

https://franzskuffka.github.io/vue-medium.js/

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024 2

Done: http://robertleeplummerjr.github.io/vue-medium.js/

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024 2

tears up from the beauty

from vue.

yjkogan avatar yjkogan commented on April 19, 2024 1

Hey @yyx990803,

Is there a follow-up PR for this? Having an element with contenteditable="true" and the v-model directive doesn't work well with filters. (Here's a js fiddle).

For work I made a directive v-editable-text that both applies the contenteditable attribute and does all the v-model stuff (it's modeled after v-model). I'd be happy to roll that into this code base, or just fix v-model to work with filters.

For what it's worth, my solution is largely just incorporating the solution presented in this stack overflow post: http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html/13950376#13950376.

from vue.

janwirth avatar janwirth commented on April 19, 2024 1

@robertleeplummerjr I built a more complete version:
https://github.com/FranzSkuffka/innovant/blob/firebase-wip/app/directives/medium.coffee

You need the fixed medium.js version available in the same repository to enable modes other than 'inline'

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024 1

💝

from vue.

janwirth avatar janwirth commented on April 19, 2024 1

Now available for Medium-Editor:
https://github.com/FranzSkuffka/vue-medium-editor

compatible with vue1 and vue2 🍏

@Nobi322 you need a plugin

from vue.

yyx990803 avatar yyx990803 commented on April 19, 2024

9ec0259

from vue.

yyx990803 avatar yyx990803 commented on April 19, 2024

Thanks @yjkogan ! I'm about to get to the directives part for 0.11, and v-model is one of the directives that need some major refactoring. Would love to take a look at your v-editable-text directive to incorporate your fix.

from vue.

yjkogan avatar yjkogan commented on April 19, 2024

Sounds good! What's the best way for me to get that to you? I can send you the three relevant files (directive, helper utility, tests for the utility) whenever but to open a PR I'd need to set aside part of my work day next week. Happy to do that though!

from vue.

yyx990803 avatar yyx990803 commented on April 19, 2024

You can just put them in a gist. No pressure about the PR if you don't have time for it.

from vue.

yjkogan avatar yjkogan commented on April 19, 2024

I'm having a hard time making sure the gist has the right amount of context, so I'll probably put in the time to make a PR early next week :).

from vue.

yjkogan avatar yjkogan commented on April 19, 2024

Hey!

So, I opened a half-baked PR into our fork which you can see here. As I mention there, I'm having trouble with the unit tests and don't have time yet to dig in and figure out what's going wrong. I'd also like to add more tests and write some casperJS integration tests. We use casper as well so when I write them internally I'll port them over.

from vue.

yyx990803 avatar yyx990803 commented on April 19, 2024

Just curious, what filters are you guys using on contenteditables? Are they mostly for input validation? If you don't need to modify the contents, you can use write-only filters which will be available in 0.11.

I feel that we shouldn't put this amount of extra code into Vue core for the specific use-case of contenteditable + filters, maybe it should be a separate plugin. Thanks for working on the PR though!

from vue.

yjkogan avatar yjkogan commented on April 19, 2024

We're not using any filters at the moment, I just wanted the implementation to be "correct." It felt weird to have a directive so close to v-model that you couldn't use a filter on. If you accept that it contenteditable wont work with filters, then this is pretty much just v-model with a couple UX changes (escape to reset value and enter to blur()).

Definitely makes sense to not add so much code for something so specific. Makes me wish getting the cursor was easier for contenteditable elements, haha. When I have more time I'll look into making this a plugin :). Hope this was helpful!

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

Just thought I'd chime in, it would be VERY easy to do this with: https://github.com/jakiestfu/Medium.js/
In fact, I'm working on a project right now with Knockout that uses Medium.js. Thoughts?

from vue.

yyx990803 avatar yyx990803 commented on April 19, 2024

@robertleeplummerjr definitely, if you want full control over a contenteditable it's very simple to wrap medium.js in a custom directive.

from vue.

CJLees01 avatar CJLees01 commented on April 19, 2024

Does anyone have a working gist of such a custom directive wrapping medium.js please? Spent hours now trying to make it work, but no luck.

from vue.

straps avatar straps commented on April 19, 2024

+1 for @CJLees01 request, any news?

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

I have one, let me get source.

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

https://github.com/Enpowi/Enpowi/blob/master/src/client/Enpowi/directives.js#L145

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

I just realized that is the source editor, which uses codemirror. Let me see if I can put a sample together.

from vue.

straps avatar straps commented on April 19, 2024

Great, thanks @robertleeplummerjr

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

@FranzSkuffka mind adding a gh-pages branch for us all to fall in love with?

from vue.

janwirth avatar janwirth commented on April 19, 2024

Oh I'm too dumb to use gh-pages! Or do you have a comprehensive guide for me?

from vue.

robertleeplummerjr avatar robertleeplummerjr commented on April 19, 2024

nice

from vue.

Nobi322 avatar Nobi322 commented on April 19, 2024

Hello, I'm still new in vue.js, but this method didn't work in vue 2.0
image

from vue.

Related Issues (20)

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.