CSS conflict with reveal.js #4189
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm trying to have codemirror on my slides with reveal.js and there seems to be a css conflict.
Look at this page that reproduces the issue: http://viebel.github.io/klipse/misc/reveal-codemirror.html.
There are a couple of issues:
You would have to override the css for CodeMirror, because reveal css will change/modify the properties of div's and so on.
What you would have to alter is as follows:
Alter the CSS for getting the result, because, your CodeMirror is inside a reveal div and that will obviously add it's own css, like:
Thanks.
But my problem is with the less trivial css than
text-align.As I mentioned above:
What css should I override to fix that?
You could try wrapping your editor instances inside web components. That should remove the problems caused by agressive, unscoped CSS in reveal.js.
But in general, I'm not taking responsibility for issues like this, produced by outside CSS. You'll just have to find the relevant properties and reset them in your own CSS.
mentioned in issue #121
mentioned in issue #1735
mentioned in issue #1788
Per
@marijnhsuggestion, I've tried to put my editor instance inside a web component but still some CSS is bleeding into the editor:I know that it is probably an issue with reveal so I am reporting also in reveal repo.
Maybe you guys at CodeMirror can think of a workaround?
Moving with arrows or using space is related in to Reveal.js keyboard bindings.
https://github.com/hakimel/reveal.js/#keyboard-bindings
https://github.com/hakimel/reveal.js/blob/master/js/reveal.js#L4201
You need to be able to stop event propagation from CodeMirror editor in to Reveal.js handler.
@RopoMenHere is a version with a code mirror editor on slide 1 and a textarea on slide 2.As you can see, inside the textarea,
arrowsandspacework fine.It's because
https://github.com/hakimel/reveal.js/blob/master/js/reveal.js#L4144
If you inspect DOM in first slide you can see that CodeMirror editor is not directly using input/textarea when content is edited. (if I'm correct)
I think that reveal.js should have attribute 'reveal-keyboard-off' and code should also check whether the element has that attribute. If it has, keyboard event handler should not do anything on those events.
Thanks a lot
@RopoMenIt looks much better now.
But I'm still having weird issues. For instance, if you put the cursor at the beginning of
(map inc [1 2 3])and press the right arrow 8 times, the cursor will be at the beginning of thec- see screnshot below. And if you pressspace, a backspace will be added after thec.In general, if you play a bit with arrows and spaces, you will feel that something is really not working well.
Do you know why it happens and how coud I solve it?
I checked and couldn't see any extra characters in DOM after 'c'. That kind of bug sounds like more CodeMirror issue. (Using Chrome)
ps. How did you handled those keyboard bindings? Quickly looked in to your example and couldn't find "obvious" solution :)
I have handled the keyboard binding issue by adding
contenteditable="true". Seegithub.com/viebel/klipse@67b9abc228@marijnhmaybe you can help with this part of the problem that I mentioned above: https://github.com/codemirror/CodeMirror/issues/4189#issuecomment-271863685I did see that on Reveal rules but I thought that it would not work because
contenteditablewould make the element editable, like<div> or <p>but it actually does not work like that with custom elements :) nice.I have looked in to web components / custom html elements because to major benefit is the style isolation.
@RopoMenso why doesn't it work properly yet ?@viebelthis works fine.
What I meant was that if you add
contenteditablefor example:Browser is making
<p>tag editable and browser is not making<klipse-snippet>editable in a same way. What I thought initially was that if you addcontenteditablefor the custom element, browser would make it editable in a same way as it was<p>-tag.I mean why do we still have this issue https://github.com/codemirror/CodeMirror/issues/4189#issuecomment-271863685
I'm so frustrated: we are so close but still not there!
mentioned in issue #258
@viebelI think I found something!I get the problem you describe when I have the chrome inspector open.
But when I close the inspector/console... it works perfectly.
I think that CodeMirror calculates cursor/selection related things in a way that is affected by the changed size of the HTML area when the inspector is open????
Actually, it's a little more complicated than what I described above.
The cursor behavior is affected by the dimensions of the page.
Having the inspector open or closed affects the dimensions of the page... but any kind of resizing does as well. If the page is too narrow, the selection area is smaller than the real text. If the page is too wide, you cannot click on the text. I'll dig a bit deeper.
@viebelO.K. I got it to work...I set these in the .adoc file
:revealjs_minScale: 1.0
:revealjs_maxScale: 1.0
This prevents the scaling when the screen is narrow or wide. The scaling does not play well with codemirror.
mentioned in issue #2443