Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/js/components/field-validation/Builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
multiple
searchable
taggable
paste-delimiter="|"
close-on-select
:model-value="rules"
@selected="add($event)"
Expand Down
1 change: 1 addition & 0 deletions resources/js/components/fieldtypes/TagsFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:multiple="true"
:options="options"
:placeholder="__(config.placeholder)"
:paste-delimiter="config.paste_delimiter || ','"
:read-only="isReadOnly"
:taggable="true"
:should-open-dropdown="(open) => open && options.length > 0"
Expand Down
9 changes: 8 additions & 1 deletion resources/js/components/ui/Combobox/Combobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const props = defineProps({
options: { type: Array, default: () => [] },
/** Key of the option's value in the option's object. */
optionValue: { type: String, default: 'value' },
/** The delimiter used to split pasted text into multiple tags. Only used when `taggable` is `true`. */
pasteDelimiter: { type: String, default: ',' },
placeholder: { type: String, default: () => __('Select...') },
readOnly: { type: Boolean, default: false },
/** When `true`, the options will be searchable. */
Expand Down Expand Up @@ -315,7 +317,12 @@ function onPaste(e) {

const pastedValue = e.clipboardData.getData('text');

updateModelValue([...(props.modelValue ?? []), ...pastedValue.split(',').map((v) => v.trim())]);
const tags = pastedValue
.split(props.pasteDelimiter)
.map((v) => v.trim())
.filter((v) => v !== '');

updateModelValue([...(props.modelValue ?? []), ...tags]);
}

function pushTaggableOption(e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ protected function formBlueprint($container = null)
'type' => 'taggable',
'display' => __('Validation Rules'),
'instructions' => __('statamic::messages.asset_container_validation_rules_instructions'),
'paste_delimiter' => '|',
],
],
],
Expand Down
Loading