Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

covert to Raw stores only default draft styles #153

Closed
dotcor opened this issue Mar 4, 2016 · 2 comments
Closed

covert to Raw stores only default draft styles #153

dotcor opened this issue Mar 4, 2016 · 2 comments
Labels

Comments

@dotcor
Copy link

dotcor commented Mar 4, 2016

This looks like it is intentional.
Inside encodeInlineStyleRanges:

function encodeInlineStyleRanges(block) {
  var styleList = block.getCharacterList().map(function(c) {
    return c.getStyle();
  }).toList();
  var styles = Object.keys(DefaultDraftInlineStyle);
  var ranges = styles.map(function(style) {
    return getEncodedInlinesForType(block, styleList, style);
  });
  return Array.prototype.concat.apply(EMPTY_ARRAY, ranges);
}

customStyleMap styles are simply not saved.

A simple solution would be to pass the customStyleMap as a second parameter to convertToRaw(), since the customStyleMap lives only inside the react component.

@hellendag hellendag added the bug label Mar 4, 2016
@hellendag
Copy link

Nice catch, this is an oversight. Do you want to send a PR?

@hellendag
Copy link

cc @ezequiel

ghost pushed a commit that referenced this issue Mar 17, 2016
Summary:Addresses #153 by extracting the style key strings from the content block.
Closes #217

Reviewed By: ezequiel

Differential Revision: D3060659

fb-gh-sync-id: 7752f4f6477e61d239c9b945857fd1acca77ff42
shipit-source-id: 7752f4f6477e61d239c9b945857fd1acca77ff42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants