{"id":22867542,"url":"https://github.com/indatawetrust/preact-codemirror","last_synced_at":"2026-04-27T23:33:12.076Z","repository":{"id":57153487,"uuid":"143417827","full_name":"indatawetrust/preact-codemirror","owner":"indatawetrust","description":"Simple and lightweight CodeMirror component for Preact","archived":false,"fork":false,"pushed_at":"2018-11-16T08:07:58.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-19T21:48:00.772Z","etag":null,"topics":["codemirror","codemirror-component","preact","preact-components"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/indatawetrust.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-08-03T11:14:30.000Z","updated_at":"2018-11-16T08:08:00.000Z","dependencies_parsed_at":"2022-09-06T16:11:58.678Z","dependency_job_id":null,"html_url":"https://github.com/indatawetrust/preact-codemirror","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/indatawetrust/preact-codemirror","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Fpreact-codemirror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Fpreact-codemirror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Fpreact-codemirror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Fpreact-codemirror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indatawetrust","download_url":"https://codeload.github.com/indatawetrust/preact-codemirror/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Fpreact-codemirror/sbom","scorecard":{"id":487147,"data":{"date":"2025-08-11","repo":{"name":"github.com/indatawetrust/preact-codemirror","commit":"99dd648ee032e3707e8550463d1256f40067851a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T18:06:44.484Z","repository_id":57153487,"created_at":"2025-08-19T18:06:44.484Z","updated_at":"2025-08-19T18:06:44.484Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["codemirror","codemirror-component","preact","preact-components"],"created_at":"2024-12-13T12:27:57.741Z","updated_at":"2026-04-27T23:33:12.053Z","avatar_url":"https://github.com/indatawetrust.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# preact-codemirror\n\n\u003e Simple and lightweight CodeMirror component for Preact; for :atom_symbol: [Preact](https://github.com/developit/preact)\n\n## Usage\n\n[languages](https://github.com/codemirror/CodeMirror/tree/master/mode)\n[themes](https://github.com/codemirror/CodeMirror/tree/master/theme)\n\n```jsx\nconst { h, Component, render } = require(\"preact\");\nimport CodeMirror from \"preact-codemirror\";\n\n// import language\nimport \"codemirror/mode/sql/sql.js\";\n\n// import theme\nimport \"codemirror/theme/dracula.css\";\n\nfunction loadStyleSheet(url) {\n  var sheet = document.createElement(\"link\");\n  sheet.rel = \"stylesheet\";\n  sheet.href = url;\n  sheet.type = \"text/css\";\n  document.head.appendChild(sheet);\n  var _timer;\n\n  // TODO: handle failure\n  return new Promise(function(resolve) {\n    sheet.onload = resolve;\n    sheet.addEventListener(\"load\", resolve);\n    sheet.onreadystatechange = function() {\n      if (sheet.readyState === \"loaded\" || sheet.readyState === \"complete\") {\n        resolve();\n      }\n    };\n\n    _timer = setInterval(function() {\n      try {\n        for (var i = 0; i \u003c document.styleSheets.length; i++)\n          if (document.styleSheets[i].href === sheet.href) resolve();\n      } catch (e) {\n        /* the stylesheet wasn't loaded */\n      }\n    }, 250);\n  }).then(function() {\n    clearInterval(_timer);\n    return sheet;\n  });\n}\n\nclass Demo extends Component {\n  state = {\n    currentTheme: \"mbo\",\n    themes: [\n      \"3024-day\",\n      \"3024-night\",\n      \"abcdef\",\n      \"ambiance-mobile\",\n      \"ambiance\",\n      \"base16-dark\",\n      \"base16-light\",\n      \"bespin\",\n      \"blackboard\",\n      \"cobalt\",\n      \"colorforth\",\n      \"darcula\",\n      \"dracula\",\n      \"duotone-dark\",\n      \"duotone-light\",\n      \"eclipse\",\n      \"elegant\",\n      \"erlang-dark\",\n      \"gruvbox-dark\",\n      \"hopscotch\",\n      \"icecoder\",\n      \"idea\",\n      \"isotope\",\n      \"lesser-dark\",\n      \"liquibyte\",\n      \"lucario\",\n      \"material\",\n      \"mbo\",\n      \"mdn-like\",\n      \"midnight\",\n      \"monokai\",\n      \"neat\",\n      \"neo\",\n      \"night\",\n      \"oceanic-next\",\n      \"panda-syntax\",\n      \"paraiso-dark\",\n      \"paraiso-light\",\n      \"pastel-on-dark\",\n      \"railscasts\",\n      \"rubyblue\",\n      \"seti\",\n      \"shadowfox\",\n      \"solarized\",\n      \"ssms\",\n      \"the-matrix\",\n      \"tomorrow-night-bright\",\n      \"tomorrow-night-eighties\",\n      \"ttcn\",\n      \"twilight\",\n      \"vibrant-ink\",\n      \"xq-dark\",\n      \"xq-light\",\n      \"yeti\",\n      \"zenburn\"\n    ],\n    code: ` \nSELECT 'Customer' As Type, \n       FirstName + ' ' + LastName AS ContactName, \n       City, Country, Phone\n  FROM Customer\nUNION\nSELECT 'Supplier', \n       ContactName, City, Country, Phone\n  FROM Supplier\n`\n  };\n  componentWillMount() {\n    loadStyleSheet(\n      `https://codemirror.net/theme/${this.state.currentTheme}.css`\n    );\n  }\n  themeChange = e =\u003e {\n    this.setState(\n      {\n        currentTheme: e.target.value\n      },\n      () =\u003e {\n        loadStyleSheet(`https://codemirror.net/theme/${e.target.value}.css`);\n      }\n    );\n  };\n  render(props, state) {\n    return (\n      \u003cdiv\u003e\n        \u003cselect\n          onChange={this.themeChange}\n          style={{\n            width: \"100%\",\n            border: \"1px solid #ccc\",\n            height: \"30px\"\n          }}\n        \u003e\n          {state.themes.map(item =\u003e (\n            \u003coption value={item} selected={state.currentTheme == item}\u003e\n              {item}\n            \u003c/option\u003e\n          ))}\n        \u003c/select\u003e\n        \u003cCodeMirror\n          code={state.code.trim()}\n          config={{\n            mode: \"sql\",\n            theme: state.currentTheme,\n            styleActiveLine: true,\n            lineNumbers: true\n          }}\n          instance={instance =\u003e {\n            instance.on(\"change\", () =\u003e {\n              console.log(instance.getValue());\n            });\n          }}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n\nrender(\u003cDemo /\u003e, document.body);\n```\n\n[![Edit mzn9j60m48](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/mzn9j60m48)\n\n## Install\n\n```\n$ npm install --save preact-codemirror\n```\n\n```html\n\u003cscript src=\"https://unpkg.com/preact-codemirror@1.0.0/dist/preact-codemirror.min.js\"\u003e\u003c/script\u003e\n```\n\n## Properties\n\n#### code\nType: `String`\n\n#### config\nType: `Object`\n\n#### instance\nType: `Function`\n\n## License\n\nMIT © [Ahmet Şimşek](https://github.com/indatawetrust)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findatawetrust%2Fpreact-codemirror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findatawetrust%2Fpreact-codemirror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findatawetrust%2Fpreact-codemirror/lists"}