Skip to content

Commit

Permalink
Merge pull request #18 from VinsanityShred/master
Browse files Browse the repository at this point in the history
Add support for ->asHtml() on Slug field
  • Loading branch information
benjaminhirsch authored Jul 5, 2019
2 parents 92b0bbb + f24e300 commit 2072919
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"version": "1.2.4"
}
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion resources/js/components/Slug/IndexField.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<span>{{ field.value }}</span>
<div v-if="field.asHtml" v-html="field.value"></div>
<span v-else class="whitespace-no-wrap">{{ field.value }}</span>
</template>

<script>
Expand Down
10 changes: 10 additions & 0 deletions src/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public function showUrlPreview(string $url): Element
return $this;
}

/**
* Display the field as raw HTML using Vue.
*
* @return $this
*/
public function asHtml()
{
return $this->withMeta(['asHtml' => true]);
}

public function jsonSerialize()
{
return array_merge([
Expand Down

0 comments on commit 2072919

Please sign in to comment.