react-native-toolkit / react-native-draftjs

A full fledged React Native Rich Text editor based on draft.js
https://www.npmjs.com/package/react-native-draftjs-editor
MIT License
134 stars 33 forks source link

Unable to change fontsize and font family #20

Open Raghvender-Kataria opened 4 years ago

Raghvender-Kataria commented 4 years ago

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?

quanghungit commented 4 years ago

Any clues?

DaniAkash commented 4 years ago

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

for eg: fontSize: "16px"

coopdog95 commented 2 years ago

@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.

ccharliemagne commented 2 years ago

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