Giter Site home page Giter Site logo

maximizedowl / simple-markdown-editor-ts Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 35.2 MB

Web上で使えるMarkdown対応のWYSIWYGエディター

Home Page: https://maximizedowl.github.io/simple-markdown-editor-ts/

License: MIT License

HTML 6.98% CSS 5.39% TypeScript 86.38% Ruby 0.75% JavaScript 0.50%
github-pages react typescript reactmarkdown create-react-app firebase-auth react-hook-form react-syntax-highlighter mui mui-icons

simple-markdown-editor-ts's People

Contributors

maximizedowl avatar

Watchers

 avatar

simple-markdown-editor-ts's Issues

ログイン情報の保持

what

クッキーを利用してログイン情報を保持できるようにする。
またそれに伴った関連事項も実装。

Code Sandboxを利用してサンプルを作成する。
そこで成功したらこちらに適用する。

why

利便性向上

react-markdownでシンタックスハイライトを実装しようとした際に、Could not find a declaration file for module 'react-syntax-highlighter/dist/esm/styles/prism' で怒られる。

エラー内容

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 |


試したことと、その結果

  1. @types/react-syntax-highlighter のインストール。npm i --save-dev @types/react-syntax-highlighter を実行した。もともとあったimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';のエラーは消えたが、上記のエラーが残った。
  2. style属性を抜く。エラーになるSyntaxHighlighterコンポーネント自体がエラーになった。

`npm test`実行時に"Jest encountered an unexpected toke"エラー

エラー内容

下記のエラーメッセージが出る。

 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'と言われる。

タブ移動の最適化

what

Dialogでタブ移動を行うとメニューが閉じてしまう。それを中心にほかも見直して改善。

why

Bad UIとなってしまっており使いづらい。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.