This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class HashSchema | |
| def initialize(schema) | |
| @schema = schema.map { |key, type| | |
| [key, HashSchema.lookup(type)] | |
| }.to_h | |
| end | |
| def cast(params) | |
| params.map { |key, value| | |
| [key, @schema[key] ? @schema[key].cast(value) : value] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Controller} from '@hotwired/stimulus' | |
| import {Editor} from "@tiptap/core" | |
| import {Mention} from "@tiptap/extension-mention"; | |
| import StarterKit from "@tiptap/starter-kit" | |
| export default class extends Controller { | |
| static targets = ['input', 'suggestions'] | |
| connect() { | |
| this.editor = new Editor({ |