Files
baserow/web-frontend/modules/builder/store/builderToast.js
Tsering Paljor 674e4b12a8 feat: Add markdown support to more Builder elements (#6124)
* WIP

* Remove formula conversion related changes

* Move the file input click guard to formatted text component

* Move format types into their own components

* Use a shared markdown-it instance

* Move the formatter into data explorer

* Move minification logic into BaserowFormulaMinified

* Renderer should own the root element

* Ensure long choice names are truncated

* Ensure line height doesn't grow for paragraphs

* Add tests

* Add changelog

* Add specific tests for choice element
2026-10-09 09:36:32 +04:00

63 lines
1.3 KiB
JavaScript

import { uuid } from '@baserow/modules/core/utils/string'
export const state = () => ({
items: [],
})
export const mutations = {
ADD(state, toast) {
state.items.unshift(toast)
},
REMOVE(state, toast) {
const index = state.items.indexOf(toast)
state.items.splice(index, 1)
},
}
export const actions = {
/**
* Shows a toast message to the user.
*/
add({ commit }, { type, title = null, message = null, ...rest }) {
commit('ADD', {
id: uuid(),
type,
title,
message,
...rest,
})
},
infoNeutral({ dispatch }, { title, message }) {
dispatch('add', { type: 'info-neutral', title, message })
},
info({ dispatch }, { title, message, ...rest }) {
dispatch('add', { type: 'info-primary', title, message, ...rest })
},
error({ dispatch }, { title, message, details }) {
dispatch('add', { type: 'error', title, message, details })
},
warning({ dispatch }, { title, message, details }) {
dispatch('add', { type: 'warning', title, message, details })
},
success({ dispatch }, { title, message }) {
dispatch('add', { type: 'success', title, message })
},
remove({ commit }, toast) {
commit('REMOVE', toast)
},
}
export const getters = {
all(state) {
return state.items
},
}
export default {
namespaced: true,
state,
getters,
actions,
mutations,
}