template.tsx 994 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { ITemplate } from '@growi/core';
  2. import useSWR, { SWRResponse } from 'swr';
  3. import { getGrowiFacade } from '~/utils/growi-facade';
  4. const presetTemplates: ITemplate[] = [
  5. // preset 1
  6. {
  7. id: '__preset1__',
  8. name: '[Preset] WESEEK Inner Wiki Style',
  9. markdown: `# 関連ページ
  10. $lsx()
  11. # `,
  12. },
  13. // preset 2
  14. {
  15. id: '__preset2__',
  16. name: '[Preset] Qiita Style',
  17. markdown: `# <会議体名>
  18. ## 日時
  19. yyyy/mm/dd hh:mm〜hh:mm
  20. ## 場所
  21. ## 出席者
  22. -
  23. ## 議題
  24. 1. [議題1](#link)
  25. 2.
  26. 3.
  27. ## 議事内容
  28. ### <a name="link"></a>議題1
  29. ## 決定事項
  30. - 決定事項1
  31. ## アクション事項
  32. - [ ] アクション
  33. ## 次回
  34. yyyy/mm/dd (予定、時間は追って連絡)`,
  35. },
  36. ];
  37. export const useTemplates = (): SWRResponse<ITemplate[], Error> => {
  38. return useSWR(
  39. 'templates',
  40. () => [
  41. ...presetTemplates,
  42. ...Object.values(getGrowiFacade().customTemplates ?? {}),
  43. ],
  44. {
  45. fallbackData: presetTemplates,
  46. },
  47. );
  48. };