maximizedowl / simple-markdown-editor-ts Goto Github PK
View Code? Open in Web Editor NEWWeb上で使えるMarkdown対応のWYSIWYGエディター
Home Page: https://maximizedowl.github.io/simple-markdown-editor-ts/
License: MIT License
Web上で使えるMarkdown対応のWYSIWYGエディター
Home Page: https://maximizedowl.github.io/simple-markdown-editor-ts/
License: MIT License
クッキーを利用してログイン情報を保持できるようにする。
またそれに伴った関連事項も実装。
Code Sandboxを利用してサンプルを作成する。
そこで成功したらこちらに適用する。
利便性向上
ERROR in src/App.tsx:14:22
TS7016: Could not find a declaration file for module 'react-syntax-highlighter/dist/esm/styles/prism'. '/hoge/simple-markdown-editor-ts/node_modules/react-syntax-highlighter/dist/esm/styles/prism/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/react-syntax-highlighter` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-syntax-highlighter/dist/esm/styles/prism';`
12 | import ReactMarkdown from 'react-markdown';
13 | import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
> 14 | import { dark } from 'react-syntax-highlighter/dist/esm/styles/prism';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 | import remarkGfm from 'remark-gfm';
16 | import './App.css';
17 |
npm i --save-dev @types/react-syntax-highlighter
を実行した。もともとあったimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
のエラーは消えたが、上記のエラーが残った。下記のエラーメッセージが出る。
FAIL src/App.test.tsx
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/foobuzz/Documents/Sandbox/simple-markdown-editor-ts/node_modules/react-markdown/index.js:6
export {uriTransformer} from './lib/uri-transformer.js'
^^^^^^
SyntaxError: Unexpected token 'export'
1 | import { useState } from 'react';
> 2 | import ReactMarkdown from 'react-markdown';
| ^
3 | import remarkGfm from 'remark-gfm';
4 | import './App.css';
5 |
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
at Object.<anonymous> (src/App.tsx:2:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 3.498 s
Ran all test suites related to changed files.
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
node_modules の中でSyntaxError: Unexpected token 'export'
と言われる。
npm test
実行時にエラーが出る。下記はエラーメッセージ抜粋。
Error: jest-haste-map: Watchman crawl failed. Retrying once with node crawler.
watchman のアクセスを許可することで解決できた。
System Preferences > Security & Privacy > Privacy > Files and Folders and manually gave watchman access.1
ボタンを押すことで動的にテーマを変更させたい。
見栄えを良くするため。
Dialogでタブ移動を行うとメニューが閉じてしまう。それを中心にほかも見直して改善。
Bad UIとなってしまっており使いづらい。
増えてしまった handleClickHoge()
等を関数を共通化して内部で分岐させる。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.