{"id":15021355,"url":"https://github.com/begedin/philtre","last_synced_at":"2026-03-12T06:01:41.945Z","repository":{"id":37000981,"uuid":"423168600","full_name":"begedin/philtre","owner":"begedin","description":"A block-based content editor in elixir","archived":false,"fork":false,"pushed_at":"2022-10-29T16:48:32.000Z","size":398,"stargazers_count":39,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T09:32:15.037Z","etag":null,"topics":["elixir","phoenix","phoenixliveview"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/philtre","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/begedin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-31T14:20:15.000Z","updated_at":"2025-10-03T06:27:44.000Z","dependencies_parsed_at":"2022-08-19T03:30:38.318Z","dependency_job_id":null,"html_url":"https://github.com/begedin/philtre","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/begedin/philtre","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begedin%2Fphiltre","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begedin%2Fphiltre/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begedin%2Fphiltre/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begedin%2Fphiltre/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/begedin","download_url":"https://codeload.github.com/begedin/philtre/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begedin%2Fphiltre/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30416732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:41:02.746Z","status":"ssl_error","status_checked_at":"2026-03-12T04:40:12.571Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","phoenix","phoenixliveview"],"created_at":"2024-09-24T19:56:29.410Z","updated_at":"2026-03-12T06:01:41.897Z","avatar_url":"https://github.com/begedin.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Readme\n\n## Description\n\nA block-based content editor, with support for static html generation, in phoenix live view.\n\n\u003e #### Disclaimer {: .warning}\n\u003e\n\u003e **This library is still heavily in development.**\n\u003e\n\u003e Things will break and at least initially, they\n\u003e will not maintain backwards compatibility. In fact, the final, release-worthy version may never\n\u003e see the light of day.\n\u003e\n\u003e Use it at your own risk!\n\nCurrently supports the following blocks:\n\n- a generic content-editable wrapped which can output any of:\n  `\u003cp\u003e`, `\u003ch1\u003e`, `\u003ch2\u003e`, `\u003ch3\u003e`, `\u003cul\u003e`, `\u003cpre\u003e`, `\u003cblockquote\u003e`\n- a very badly styled table\n- a code block with synthax highlighting for elixir only\n\n## Installation and Usage\n\nAdd it to your dependencies in `mix.exs`:\n\n```elixir\ndeps: [\n  # ...\n  {:philtre, \"~\u003e 0.12.2\"}\n  # ...\n]\n```\n\nInclude the styles somewhere in your application, for example, from `app.js`:\n\n```typescript\nimport 'philtre/dist/index.css';\n```\n\nOr from `app.css`:\n\n```css\n@import 'philtre/dist/index.css';\n```\n\nImport and add the necessary hooks to your live view application\n\n```typescript\nimport * as philtreHooks from 'philtre/src/hooks';\n\nconst liveSocket = new LiveSocket('/live', Socket, {\n  hooks: { ...philtreHooks, ...yourHooks },\n});\n```\n\nRender the page component inside one of your live views\n\n```elixir\ndef mount(%{}, _session, socket) do\n  {:ok, assign(socket, %{editor: Philtre.Editor.new()})}\nend\n\ndef render(assigns) do\n  ~H\"\"\"\n  \u003cbutton phx-click=\"save\"\u003eSave\u003c/button\u003e\n  \u003c.live_component\n    module={Philtre.UI.Page}\n    id={@editor.id}\n    editor={@editor}\n  /\u003e\n  \"\"\"\nend\n\ndef handle_event(\"save\", %{}, socket) do\n  json = Philtre.Editor.serialize(socket.assigns.json)\n  # Save the json however you please\n  # Load into editor using Philtre.Editor.normalize/1\n  inspect(json)\n  {:noreply, socket}\nend\n\ndef handle_info({:update, %Philtre.Editor{} = editor}, socket) do\n  {:noreply, assign(socket, :editor, editor)}\nend\n```\n\n## Developing using Playground\n\nPlayground is a locally setup, minimal phoenix application which loads the editor files using local paths, so they are always kept up to date and are even being watched by esbuild.\n\nTHis means it allows for live-reload development of hte library.\n\nTo start it, run `mix playground`\n\nNote that editor pages are saved as files under `playground\\priv\\documents` so you should probably periodically clean them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbegedin%2Fphiltre","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbegedin%2Fphiltre","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbegedin%2Fphiltre/lists"}