Git Product home page Git Product logo

Comments (13)

OliverJAsh avatar OliverJAsh commented on September 24, 2024

Hey Matthew. I can’t see how you’re calling Scribe.insertHTML in the video. Is it from the console?

from scribe.

matthewmueller avatar matthewmueller commented on September 24, 2024

haha, yah sorry about that. in this case, pressing "B" triggers it. But I think it should be reproducible with any trigger.

from scribe.

OliverJAsh avatar OliverJAsh commented on September 24, 2024

Sorry, I don’t think I understand. Pressing “B” to make something bold?

Also, what browser/version?

from scribe.

matthewmueller avatar matthewmueller commented on September 24, 2024

so it's just the trigger I chose to call Scribe.insertHTML. I could have went with a button but it was easier for me to do this at the time. it's unrelated to bold.

latest chrome (v. 33)

from scribe.

OliverJAsh avatar OliverJAsh commented on September 24, 2024

I can’t seem to reproduce this. Also, from your video it seems to be producing a B element, not a SPAN? It looks like the issue is that it’s erroneously adding inline styles for font-size/line-height?

Out of curiosity, do you have a line height somewhere on your page? We have seen similar issues in Chrome, which only occur when you do have an inherited line height.

Could you perhaps isolate the case even further, this time taking your custom trigger (Command+B) out of the equation and seeing what happens? If you could provide some steps to reproduce it from the console, that would be great. I tried focusing the editor (<p>foo|</p>; where | is my caret) and then calling scribe.insertHTML('<b>bar</b>'); to no avail.

from scribe.

OliverJAsh avatar OliverJAsh commented on September 24, 2024

Any updates? Let me know or I can close this.

from scribe.

TooTallNate avatar TooTallNate commented on September 24, 2024

Just wanted to note that the root cause of this was CSS in our code base.

It seems like if you have non-standard font-size on the editor div then that will cause Chrome to inline those styles on certain elements under some circumstances.

It would definitely be good to figure out when this comes in and strip those styles if possible.

from scribe.

TooTallNate avatar TooTallNate commented on September 24, 2024

@OliverJAsh We could add that to your list of browser inconsistencies ;)

from scribe.

matthewmueller avatar matthewmueller commented on September 24, 2024

ahh good to know!

from scribe.

OliverJAsh avatar OliverJAsh commented on September 24, 2024

I’m still unable to reproduce this issue. Do you have any steps to reproduce this? @TooTallNate @matthewmueller

from scribe.

theefer avatar theefer commented on September 24, 2024

This sounds very much like the issue we had to patch (in https://github.com/guardian/scribe/blob/master/src/plugins/core/patches/events.js). Could it be a regression, or an extended case? Would be good to be able to reproduce to see which one it may be.

Thanks

from scribe.

joegoldbeck avatar joegoldbeck commented on September 24, 2024

Not a Scribe user but I was hitting a similar issue with document.execCommand('insertHTML', ...) in general on Chrome and came across this bug report.

The issue with inline styles being inserted seems to occur when inserting html into a child div that is inside of a contenteditable div, when the child div has different styling than parent contenteditable div. For whatever reason, Chrome seems to want to force the inserted HTML to have the same styling as the parent contenteditable div, and does this by adding inline styles to tags and, if there is no wrapping element to style, wrapping inserted HTML in inline styling spans.

from scribe.

dcsaszar avatar dcsaszar commented on September 24, 2024

FYI, I did a bit of research for a similar issue in yabwe/medium-editor#543

A small reproducing example: https://jsfiddle.net/y4x3vu61/
A larger one with a workaround: https://jsfiddle.net/hsn9a6jo/4/

from scribe.

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.