commentModeプロパティをGcCommentMode.ThreadModeに設定すると、スレッドモードが適用されます。
import "./styles.css";
import "@mescius/inputman.comment/CSS/gc.inputman.comment.css";
import "@mescius/inputman.richtexteditor/CSS/gc.inputman.richtexteditor.css";
import { InputMan } from "@mescius/inputman.comment";
import * as RichTextEditorControl from "@mescius/inputman.richtexteditor";
import { postedComments } from './data';
const gcComment = new InputMan.GcComment(document.getElementById('gcComment'), {
commentMode: InputMan.GcCommentMode.ThreadMode,
editorConfig: {
editorType: InputMan.GcCommentEditorType.GcRichTextEditor,
baseUrl: '$IMDEMOROOT$/lib/purejs/node_modules/@mescius/inputman.richtexteditor/JS',
plugins: [RichTextEditorControl.InputMan.GcRichTextEditorPluginItem.All],
height: 150,
menubar: [],
toolbar: [
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Emoticons,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.BlockQuote,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.FontFamily,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.FontSize,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Bold,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Italic,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Strikethrough,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Underline,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Subscript,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.LeftToRight,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.RightToLeft,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Paste,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.PasteText,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.HTMLCode,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.CharMap,
],
fontFamilyList: [
"Serif",
"Sans-serif",
"Monospace",
"Cursive",
"Arial",
"Times New Roman",
],
},
userInfo: {
id: '1',
name: '森上 偉久馬',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar1.png',
},
loadComments: (args) => {
return {
comments: postedComments
};
},
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="コメントコンポーネント 使い方" lang="ja" xml:lang="ja" />
<title>コメントコンポーネント - 表示モード - スレッドモード</title>
<!-- SystemJS -->
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
window.onload = function() {
System.import('./src/app');
}
</script>
</head>
<body>
<div id="gcComment"></div>
</body>
</html>
body {
box-sizing: content-box !important;
height: 551px !important;
}
export const postedComments = [
{
id: '1',
userInfo: {
id: '1',
name: '森上 偉久馬',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar1.png',
},
content: '森上です!これからどうぞよろしくお願いいたします。',
postTime: new Date(2024, 1, 1, 8, 0, 0),
updateTime: new Date(2024, 1, 1, 8, 0, 0),
reactions: [
{
reactionChar: '👍',
count: 2,
},
],
},
{
id: '2',
userInfo: {
id: '5',
name: '松沢 誠一',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar5.png',
},
content: '新入社員の松沢と申します。<br> 1日でも早くみなさまのお役に立てるよう、努力してまいります。<br>どうぞよろしくお願いいたします。',
postTime: new Date(2024, 7, 23, 8, 1, 59),
updateTime: new Date(2024, 7, 23, 8, 1, 59),
reactions: [
{
reactionChar: '👍',
count: 6,
currentUserReacted: true,
},
],
},
{
id: '3',
userInfo: {
id: '3',
name: '加藤 泰江',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar3.png',
},
content: '加藤です。よろしくお願いします!',
postTime: new Date(2024, 7, 16, 8, 1, 59),
updateTime: new Date(2024, 7, 16, 8, 1, 59),
parentCommentId: '2',
},
{
id: '4',
userInfo: {
id: '2',
name: '葛城 孝史',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar2.png',
},
content: '営業部の葛城です。入社おめでとうございます。<br> わからないことがあれば気軽に声をかけてください。<br> よろしくお願いいたします。',
postTime: new Date(2024, 7, 21, 8, 1, 59),
updateTime: new Date(2024, 7, 21, 8, 1, 59),
parentCommentId: '2',
reactions: [
{
reactionChar: '👍',
count: 2,
currentUserReacted: true,
},
],
},
{
id: '5',
userInfo: {
id: '5',
name: '松沢 誠一',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar5.png',
},
content: 'ありがとうございます。よろしくお願いいたします。',
postTime: new Date(2024, 6, 15, 8, 1, 59),
updateTime: new Date(2024, 6, 15, 8, 1, 59),
parentCommentId: '4',
reactions: [
{
reactionChar: '👍',
count: 1,
},
],
},
{
id: '6',
userInfo: {
id: '4',
name: '川村 匡',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar4.png',
},
content: '川村と申します。どうぞよろしくお願いいたします。',
postTime: new Date(2024, 4, 20, 8, 1, 1),
updateTime: new Date(2024, 4, 20, 8, 1, 1),
parentCommentId: '2',
reactions: [
{
reactionChar: '🔥',
count: 1,
}
],
},
{
id: '7',
userInfo: {
id: '6',
name: '成宮 真紀',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar6.png',
},
content: '成宮です。わからないことがあれば気軽に聞いてくださいね!',
postTime: new Date(2024, 7, 20, 7, 18, 52),
updateTime: new Date(2024, 7, 20, 8, 1, 59),
reactions: [
{
reactionChar: '👍',
count: 1,
},
],
},
{
id: '8',
userInfo: {
id: '5',
name: '松沢 誠一',
avatar: '$IMDEMOROOT$/ja/samples/comment/commentMode/threadMode/img/avatar5.png',
},
content: 'よろしくお願いいたします。',
postTime: new Date(2024, 7, 20, 7, 18, 52),
updateTime: new Date(2024, 7, 20, 8, 1, 59),
parentCommentId: '7',
reactions: [
{
reactionChar: '👍',
count: 1,
},
],
}
];
System.config({
transpiler: 'plugin-babel',
babelOptions: {
es2015: true
},
meta: {
'*.css': { loader: 'css' }
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'@mescius/inputman': 'npm:@mescius/inputman/index.js',
'@mescius/inputman/CSS': 'npm:@mescius/inputman/CSS',
'@mescius/inputman.richtexteditor': 'npm:@mescius/inputman.richtexteditor/index.js',
'@mescius/inputman.richtexteditor/CSS': 'npm:@mescius/inputman.richtexteditor/CSS',
'@mescius/inputman.comment': 'npm:@mescius/inputman.comment/index.js',
'@mescius/inputman.comment/CSS': 'npm:@mescius/inputman.comment/CSS',
'css': 'npm:systemjs-plugin-css/css.js',
'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
src: {
defaultExtension: 'js'
},
"node_modules": {
defaultExtension: 'js'
},
}
});