Skip to content

Commit

Permalink
fix: remove bootstrap initialisation of blank row on empty form. It i…
Browse files Browse the repository at this point in the history
…s not required.
  • Loading branch information
lucasnetau committed Nov 4, 2023
1 parent 10d80ea commit b8fd49a
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/js/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,6 @@ function FormBuilder(opts, element, $) {
if (enhancedBootstrapEnabled()) {
$stage.on('stageEmptied', () => {
formRows = [] //Reset row count
checkSetupBlankStage()
})
}

Expand Down Expand Up @@ -2116,8 +2115,6 @@ function FormBuilder(opts, element, $) {
if (rowWrapper.length) {
autoSizeRowColumns(rowWrapper, true)
}

checkSetupBlankStage()
})

$(document).on('fieldOpened', (event, data) => {
Expand Down Expand Up @@ -2154,33 +2151,6 @@ function FormBuilder(opts, element, $) {
})
}

/**
* enhancedBootstrap feature helper
*/
function checkSetupBlankStage() {
if (!(enhancedBootstrapEnabled() && h.stageIsEmpty())) {
return
}

const columnData = prepareFieldRow({})

const rowWrapperNode = m('div', null, {
id: `${h.incrementId(data.lastID)}-row`,
className: `row row-${columnData.rowUniqueId} ${rowWrapperClass}`,
})

$stage.append(rowWrapperNode)
setupSortableRowWrapper(rowWrapperNode)
ResetAllInvisibleRowPlaceholders()

//Create 1 invisible placeholder which will allow the initial drag anywhere in the stage
$stage
.find(tmpRowPlaceholderClassSelector)
.eq(0)
.removeClass(invisibleRowPlaceholderClass)
.css({ backgroundColor: 'transparent' })
}

function toggleGridModeActive(active = true) {
if (active) {
gridMode = true
Expand Down Expand Up @@ -2472,9 +2442,6 @@ function FormBuilder(opts, element, $) {
if (opts.stickyControls.enable) {
h.stickyControls($stage)
}

checkSetupBlankStage()

clearTimeout(onRenderTimeout)
}, 0)
})
Expand Down

0 comments on commit b8fd49a

Please sign in to comment.