Skip to content

Commit

Permalink
fix: bug fixed when className option is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjuanes authored Jul 30, 2023
1 parent 0d0508e commit 7769533
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codecake.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const create = (parent, options = {}) => {
const editor = parent.querySelector(".codecake-editor");
const lines = parent.querySelector(".codecake-lines");
!options?.readOnly && editor.setAttribute("contenteditable", "plaintext-only");
(options?.className || "").split(" ").forEach(cn => parent.querySelector(".codecake").classList.add(cn));
(options?.className || "").split(" ").filter(c => !!c).forEach(c => parent.querySelector(".codecake").classList.add(c));
options?.lineNumbers && (parent.querySelector(".codecake-gutters").style.display = "");
options?.lineNumbers && (lines.style.display = "");
// 'plaintext-only' mode is not supported in Firefox
Expand Down

0 comments on commit 7769533

Please sign in to comment.