storybookjs/storybook

Allow to disable HTML escape in text control

開放

#12,516 建立於 2020年9月18日

 (6 則留言) (8 個反應) (0 位負責人)TypeScript (10,058 個分叉)batch import
addon: controlsfeature requesthelp wantedtriage:reviewed

倉庫指標

星標
 (89,909 顆星)
PR 合併指標
 (平均合併 7天 22小時) (30 天內合併 184 個 PR)

描述

Is your feature request related to a problem? Please describe. After updating to v6, I want to have a control with text input that allows to insert HTML. It is usefull for components with slots to see how the component behave.

Describe the solution you'd like Have an escapeHTML: false property in argTypes for text inputs, just like there is in knobs.

Describe alternatives you've considered I have a function that insert text input in a dynamicaly created div.

const stringAsHtml: (str: string) => HTMLDivElement = (str: string) => {
  const dom: HTMLDivElement = document.createElement('div');
  dom.innerHTML = str;
  return dom;
};

Are you able to assist bring the feature to reality? no

Additional context We talked about this in Discord channel addon-controls

貢獻者指南