react-native-draftjs icon indicating copy to clipboard operation
react-native-draftjs copied to clipboard

Unable to change fontsize and font family

Open Raghvender-Kataria opened this issue 5 years ago • 4 comments

I want to assign some custom fontsize and font family. I tried to put in below code in styleMap prop of "RNDraftView" but it did not appear on editor. const styleMap = { CODE: { fontFamily: '"Inconsolata", "Menlo", "Consolas", monospace', fontSize: 16, padding: 2, }, };

Any clues?

Raghvender-Kataria avatar Mar 18 '20 15:03 Raghvender-Kataria

Any clues?

quanghungit avatar Jul 13 '20 01:07 quanghungit

This style map actually gets rendered on the web. So, CSS supported styles as shown in this document will work.

for eg: fontSize: "16px"

DaniAkash avatar Jul 13 '20 12:07 DaniAkash

@DaniAkash how are we able to style the markdown within the webview? It shows there's a styleSheet prop that takes in a CSS string, but nothing I've added seems to work. I've tried things like: styleSheet={"font-size: 16px"} or styleSheet={{ fontSize: 16 }} or styleSheet={"fontSize: 16px"} and nothing seems to actually apply styles to it. I specifically want to change the height and the fontFamily of the rendered HTML.

coopdog95 avatar Mar 28 '22 19:03 coopdog95

@coopdog95 styleSheet={`.DraftEditor-root {padding: 16px; font-family: 'Arial'} .public-DraftStyleDefault-block {margin-bottom: 8px} li > .public-DraftStyleDefault-block {margin-bottom: 4px !important;}`}

ccharliemagne avatar Sep 06 '22 07:09 ccharliemagne