Skip to content

Commit

Permalink
Remove defineClassAs function (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushuhei authored Feb 17, 2023
1 parent d74d07b commit f0b6bc1
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions javascript/src/html_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,9 @@ class Paragraph {
*/
export interface HTMLProcessorOptions {
/**
* This class name is added to the containing block
* when the BudouX is applied.
*
* The caller is responsible for defining the class.
* {@link defineClassAs} can append a `<style>` element
* that defines the default styles as a class.
* This class name is added to the containing block when the BudouX is applied.
* The containing block should have following CSS properties to make it work.
* `{ word-break: keep-all; overflow-wrap: break-word; }`
*
* When falsy, an inline style is set instead.
*/
Expand Down Expand Up @@ -461,15 +458,4 @@ export class HTMLProcessor {
style.wordBreak = 'keep-all';
style.overflowWrap = 'break-word';
}

/**
* Append a `<style>` element that defines the default styles as a class.
* @param document The document to append to.
* @param className The CSS class name.
*/
static defineClassAs(document: Document, className: string): void {
const style = document.createElement('style');
style.textContent = `.${className} { word-break: keep-all; overflow-wrap: break-word; }`;
document.head.appendChild(style);
}
}

0 comments on commit f0b6bc1

Please sign in to comment.