Comments (27)
Done!
https://github.com/FranzSkuffka/vue-medium.js
https://franzskuffka.github.io/vue-medium.js/
from vue.
Done: http://robertleeplummerjr.github.io/vue-medium.js/
from vue.
tears up from the beauty
from vue.
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.
@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.
💝
from vue.
Now available for Medium-Editor:
https://github.com/FranzSkuffka/vue-medium-editor
compatible with vue1 and vue2 🍏
@Nobi322 you need a plugin
from vue.
from vue.
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.
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.
You can just put them in a gist. No pressure about the PR if you don't have time for it.
from vue.
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.
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.
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.
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.
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.
@robertleeplummerjr definitely, if you want full control over a contenteditable it's very simple to wrap medium.js in a custom directive.
from vue.
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.
+1 for @CJLees01 request, any news?
from vue.
I have one, let me get source.
from vue.
https://github.com/Enpowi/Enpowi/blob/master/src/client/Enpowi/directives.js#L145
from vue.
I just realized that is the source editor, which uses codemirror. Let me see if I can put a sample together.
from vue.
Great, thanks @robertleeplummerjr
from vue.
@FranzSkuffka mind adding a gh-pages branch for us all to fall in love with?
from vue.
Oh I'm too dumb to use gh-pages! Or do you have a comprehensive guide for me?
from vue.
nice
from vue.
Hello, I'm still new in vue.js, but this method didn't work in vue 2.0
from vue.
Related Issues (20)
- Type augmentation is broken when using typescript's moduleResolution: "Bundler" option
- [Docs] $emit('input', value) cancels event.preventDefault() HOT 1
- named slot + forceUpdate dont work HOT 2
- <percentage> in css @property is handled incorrectly after run build HOT 2
- `triggerRef` does not trigger `watch` HOT 4
- vue的tags组件router-link标签跳转已打开页面不重新加载数据,有什么好方法吗? HOT 2
- Vue2.7 defineEmits/defineProps compile error HOT 6
- Vue 2.7.16 bug: Some types has not export
- Version 2.7.15 introduced breaking changes about getCurrentScope HOT 2
- $forceUpdate causes getCurrentScope to get an incorrect value HOT 2
- Missing "./types" specifier in "vue" package, how to use withDefaults in Vue2.7.15 with ts setup HOT 1
- When ref and reactive are used together with computed and watch, computed loses its effect. HOT 2
- Using v-show and :style="display: 'block'" simultaneously does not yield the expected results in version 2.7.16. HOT 5
- function setCurrentInstance(vm) crashes when vm._scope is undefined HOT 2
- 如果只是在某个方法调用时写jsx也是需要这样写吗?
- Component caching - wrong type returned in a `set` method HOT 1
- Dynamic component not rendering slot tree HOT 1
- Urgent: Black Duck Vulnerability Fix Needed for 'vue-template-compiler' HOT 1
- Why does manipulating the style property of the DOM not take effect? HOT 1
- Memory leak when using functional components in Vue 2.7.14 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue.