Skip to content

Commit

Permalink
fix: make some more cleanup with now optional DOMPurify (#1508)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored May 7, 2024
1 parent 6958282 commit 7fafbcc
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/column-functionalities/Formatters.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Since version 4.x, you can now also return native DOM element instead of an HTML
2. Performance (the reasons are similar to point 1.)
- since it's native it can be appended directly to the grid cell
- when it's an HTML string, it has to do 2 extra steps (which is an overhead process)
i. sanitize the string (we use [DOMPurify](https://github.com/cure53/DOMPurify) by default)
i. sanitize the string (when a sanitizer, for example [DOMPurify](https://github.com/cure53/DOMPurify))
ii. SlickGrid then has to convert it to native element by using `innerHTML` on the grid cell
Demo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,3 @@ this.columnDefinitions = [
}
];
```
### Change Default DOMPurify Options (sanitize html)
If you find that the HTML that you passed is being sanitized and you wish to change it, then you can change the default `sanitizeHtmlOptions` property defined in the Global Grid Options, for more info on how to change these global options, see the `Global Grid Options` and also take a look at the [GitHub - DOMPurify](https://github.com/cure53/DOMPurify#can-i-configure-it) configurations.
4 changes: 0 additions & 4 deletions docs/column-functionalities/filters/Select-Filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ this.columnDefinitions = [
];
```

#### Change Default DOMPurify Options (sanitize html)
If you find that the HTML that you passed is being sanitized and you wish to change it, then you can change the default `sanitizeHtmlOptions` property defined in the Global Grid Options, for more info on how to change these [global options](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/global-grid-options.ts).


### Collection Add Blank Entry
In some cases a blank entry at the beginning of the collection could be useful, the most common example for this is to use the first option as a blank entry to tell our Filter to show everything. So for that we can use the `addBlankEntry` flag in `collectionOptions
Expand Down
1 change: 0 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@slickgrid-universal/binding": "workspace:~",
"@slickgrid-universal/event-pub-sub": "workspace:~",
"@slickgrid-universal/utils": "workspace:~",
"@types/dompurify": "^3.0.5",
"@types/sortablejs": "^1.15.8",
"autocompleter": "^9.2.1",
"dequal": "^2.0.3",
Expand Down
3 changes: 0 additions & 3 deletions packages/custom-tooltip-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,5 @@ export class MyExample {
### Internal Dependencies
- [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)

### External Dependencies
- [DOM Purify](https://github.com/cure53/DOMPurify) to sanitize HTML text

### Installation
Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation)
3 changes: 0 additions & 3 deletions packages/custom-tooltip-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,5 @@
"dependencies": {
"@slickgrid-universal/common": "workspace:~",
"@slickgrid-universal/utils": "workspace:~"
},
"devDependencies": {
"@types/dompurify": "^3.0.5"
}
}
8 changes: 1 addition & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7fafbcc

Please sign in to comment.