Comments (5)
So I've put a couple of hours into implementing this into firepad. Not terribly hard once you dive into the firepad code. I've got custom classes being added to pre tags just fine, but I've run into a problem with the way codemirror/firepad do their cursor calculations.
Basically, adding extra top and bottom padding to pre.firepad-header-1 throws the cursor calculations off and the cursor doesnt match up with the 'real' position of where codemirror is inserting text. This also pops up when you have remote user cursors in your editor.
From a bit of research I assume that this is because codemirror assumes all lines to have the same padding/line spacing. Any custom padding in a
element does not get calculated in codemirror's cursor math.Any ideas/pointers as to what direction to proceed?
from firepad.
(I understand codemirror/firepad are both code editors by design, not wysiwyg editors, but i really dont want to drop firepad collaboration by moving to a different wysiwyg editor)
from firepad.
Cool! Thanks for diving into the code. :-)
You're probably right about the reasoning, but as a quick sanity-check you might want to try calling .refresh() on the codemirror instance to see if that fixes it. I've run into issues a few times where cursor calculation gets off until I manually refresh codemirror. So it'd be good to rule that out.
from firepad.
My experience ( cben/mathdown#16
cben/mathdown#16) was that any vertical
padding/margins, whether on spans or the line element, confuse CM.
I didn’t dig deep to understand why.
CM does respect line-height which can be abused to create vertical space.
The drawback is that if a long header gets wrapped, the vertical spacewould
apply between the wrapped lines; so you probably want to apply
line-heightto e.g. first char only.
2013/12/18 Michael Lehenbauer [email protected]
Cool! Thanks for diving into the code. :-)
You're probably right about the reasoning, but as a quick sanity-check you
might want to try calling .refresh() on the codemirror instance to see if
that fixes it. I've run into issues a few times where cursor calculation
gets off until I manually refresh codemirror. So it'd be good to rule that
out.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-30812506
.
from firepad.
I see now that you were ahead of me - I just figured that CodeMirror does
support vertical padding (but not margin) on the
surrounding a line.
Which is what you described.But Firepad-drawn cursors of other users are sometimes out of sync.
OTOH Firepad-drawn selections by other users always change position/size
when text resizes. Perhaps cursor drawing could changed to use same
mechanism as selections?2014/1/1 Beni Cherniavsky-Paskin [email protected]
My experience ( cben/mathdown#16
cben/mathdown#16) was that any vertical
padding/margins, whether on spans or the line element, confuse CM.
I didn’t dig deep to understand why.CM does respect line-height which can be abused to create vertical space.
The drawback is that if a long header gets wrapped, the vertical spacewould
apply between the wrapped lines; so you probably want to apply line-heightto e.g. first char only.2013/12/18 Michael Lehenbauer [email protected]
Cool! Thanks for diving into the code. :-)
You're probably right about the reasoning, but as a quick sanity-check
you might want to try calling .refresh() on the codemirror instance to see
if that fixes it. I've run into issues a few times where cursor calculation
gets off until I manually refresh codemirror. So it'd be good to rule that
out.—
Reply to this email directly or view it on GitHubhttps://github.com/firebase/firepad/issues/17#issuecomment-30812506
.
from firepad.
Related Issues (20)
- Undo is removing the whole multiline code instead of current line. HOT 2
- firebase is not defined HOT 1
- How to use firepad with java script spread sheet? HOT 1
- latest version is not available from CDN HOT 3
- Distribute Typescript type file(s, *.d.ts) to allow type-safe use from Typescript HOT 2
- Monaco example: Firepad is not defined HOT 1
- context is undefined when this module gets bundled using Babel 6 HOT 2
- When Firepad is disposed, CodeMirror undo/redo don't return to their original state
- Drag to move text with codemirror
- issue with Firepad sample project and integration with this tool
- Monaco Adapter Bug - Multi-Change Event Errors HOT 1
- I'm not able to initalize an instance of firepad in react.js HOT 2
- Android keyboard compatibility
- Regular Expression DoS vulnerability
- Monaco undo affects other user HOT 10
- FirePads List
- Are you still looking for an active fork to recommend? HOT 1
- Firepad is not working with Firebase V9 HOT 1
- Dragon
- Y
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 firepad.