Skip to content

Commit

Permalink
added break size
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadlyArtist committed Jul 12, 2024
1 parent 03f2457 commit 271946d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions js/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@ class Flow {
settings.useTooltipInstead = options.useTooltipInstead ?? true;
} else if (type === Flow.emptyType) {
// Do nothing
} else if (type === Flow.breakType) {
settings.size = Math.min(8, Math.max(0, options.size));
} else if (type === Flow.rulerType) {
settings.vertical = options.vertical;
} else if (type === Flow.codeType) {
Expand Down Expand Up @@ -800,8 +802,8 @@ class Flow {
settings.contentElement = element;

if (type == Flow.breakType) {
if (containered) element.classList.add('vb-1');
else element.classList.add('hb-1');
if (containered) element.classList.add('vb-' + settings.size);
else element.classList.add('hb-' + settings.size);
} else if (type == Flow.rulerType) {
const ruler = element.vertical ? vr() : hr();
element.appendChild(ruler);
Expand Down
5 changes: 4 additions & 1 deletion js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ onmessage = async function(e){

/**
* Creates a break.
*
* - **size** (number) [optional]: How large the break is. Must be between 1 and 8.
*/
function createBreak(options = null) {
function createBreak(size, options = null) {
const content = {
type: breakType,
size,
options,
};
return content;
Expand Down

0 comments on commit 271946d

Please sign in to comment.