スタイルの設定

このサンプルではコメントコンポーネントの背景色や幅、高さなどのスタイルをCSSに設定する場合のソースコードを確認することができます。

本製品ではコメントコンポーネントの高さや幅などのサイズのほか、背景色や文字色などを含め、コンポーネントの外観はすべてCSS(Cascading Style Sheet)により設定します。 コンポーネントで使用されるCSSクラスの詳細については、以下の製品ヘルプをご参照ください。 コメントコンポーネントのCSS
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'; import "@mescius/inputman.richtexteditor/JS/plugins/all"; const gcComment = new InputMan.GcComment(document.getElementById('gcComment'), { openLinkMode: InputMan.OpenLinkMode.GoToComment, editorConfig: { editorType: InputMan.GcCommentEditorType.GcRichTextEditor, plugins: [RichTextEditorControl.InputMan.GcRichTextEditorPluginItem.All], height: 150, menubar: [], toolbar: [ RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Emoticons, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.CharMap, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.ForeColor, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Bold, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Italic, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Strikethrough, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Underline, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Link, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.OpenLink, RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.UnLink, ], contentStyle: ` body { color: white; } `, }, commentActionButtonType: InputMan.GcCommentActionButtonType.Text, commentMode: InputMan.GcCommentMode.ThreadMode, userInfo: { id: '1', name: '森上 偉久馬', avatar: '$IMDEMOROOT$/ja/samples/comment/style/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; } .gcim__gccomment { background-color: #696969; border-color: #000; } .gcim__gccomment .gcim__header-footer .gcim__search-container .gcim__search-box { background-color: white; } .gcim__gccomment .gcim__comment-container-header { background-color: #202020e0; margin-bottom: 0; } .gcim__gccomment .gcim__header-footer .gcim__sort-by { color: white; } .gcim__gccomment .gcim__header-footer { background-color: #202020e0; } .gcim__gccomment .gcim__header-footer .gcim__sort-by .gcim__combo { color: #000; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-info .gcim__comment-name { color: white; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-info .gcim__avatar { background-color: #bdbcbce0; border-radius: 30%; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-action .gcim__action-reaction .gcim__add-reaction .gcim__add-reaction-img { background-color: white; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-action .gcim__action-reaction .gcim__reaction-collection .gcim__reaction[gcim-reacted="true"] { background-color: white; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-action .gcim__action-reaction .gcim__reaction-collection .gcim__reaction[gcim-reacted="false"] { background-color: white; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-action .gcim__action-btn[gcim-type="text"] { color: rgb(216, 214, 214); transition: background-color 0.3s ease; } .gcim__gccomment .gcim__gccomment-comment-container .gcim__comment .gcim__comment-action .gcim__action-btn[gcim-type="text"]:hover { background-color: #666; } .gcim__gccomment .gcim__gccomment-comment-container { color: white; background-color: #202020e0; border: 1px solid #ccc; border-radius: 6px; margin: 10px; padding: 12px; } .gcim__gccomment .gcim__highlight-element { background-color: #202020e0; } .gcim__gccomment .gcim__avatar { background-color: #bdbcbce0; border-radius: 30%; } .gcim__gccomment .gcim__richtexteditor .gcim__richtexteditor-editor-header { background-color: #696969; } .gcim__gccomment .gcim__richtexteditor .gcim__gccomment-addcomment-wrapper .gcim__add-comment-wrapper { background-color: #000; } .gcim__richtexteditor .gcim__richtexteditor-edit-area__iframe { background-color: #525151e0; } .gcim__gccomment .gcim__add-comment-wrapper .gcim__add-comment-action { display: flex; justify-content: flex-end; } .gcim__gccomment-addcomment-wrapper .gcim__add-comment-wrapper .gcim__add-comment-action .gcim__btn-save { font-weight: 600; color: #ffffff !important; background-color: #555657 !important; border: none; border-radius: 6px; padding: 12px 24px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease; } .gcim__gccomment-addcomment-wrapper .gcim__add-comment-wrapper .gcim__add-comment-action .gcim__btn-save:hover { background-color: #9c9c9c !important; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); transform: translateY(-2px); } .gcim__gccomment-addcomment-wrapper .gcim__add-comment-wrapper .gcim__add-comment-action .gcim__btn-cancel { background-color: #949697 !important; font-weight: 600; color: #ffffff !important; border: none; border-radius: 6px; padding: 12px 24px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .gcim__gccomment-addcomment-wrapper .gcim__add-comment-wrapper .gcim__add-comment-action .gcim__btn-cancel:hover { background-color: #8b8e91 !important; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); transform: translateY(-2px); }
export const postedComments = [ { id: '1', userInfo: { id: '1', name: '森上 偉久馬', avatar: '$IMDEMOROOT$/ja/samples/comment/style/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: '2', name: '葛城 孝史', avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar2.png' }, content: 'CSSでコメントエディタの背景色や送信ボタンのスタイル、ヘッダー/フッターのフォントサイズを設定しています。', postTime: new Date(2024, 4, 20, 8, 1, 1), updateTime: new Date(2024, 4, 20, 8, 1, 1), reactions: [ { reactionChar: '👍', count: 2, currentUserReacted: true, } ] }, { id: '3', userInfo: { id: '1', name: '森上 偉久馬', avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar1.png' }, content: 'コメント操作のスタイルも変更しています。', postTime: new Date(2024, 4, 21, 8, 2, 1), updateTime: new Date(2024, 4, 21, 8, 2, 1), parentCommentId: '2' }, ];
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.richtexteditor/JS/plugins/advlist': 'npm:@mescius/inputman.richtexteditor/JS/plugins/advlist/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/all': 'npm:@mescius/inputman.richtexteditor/JS/plugins/all/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/autosave': 'npm:@mescius/inputman.richtexteditor/JS/plugins/autosave/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/charmap': 'npm:@mescius/inputman.richtexteditor/JS/plugins/charmap/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/directionality': 'npm:@mescius/inputman.richtexteditor/JS/plugins/directionality/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/emoticons': 'npm:@mescius/inputman.richtexteditor/JS/plugins/emoticons/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/fullscreen': 'npm:@mescius/inputman.richtexteditor/JS/plugins/fullscreen/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/htmlcode': 'npm:@mescius/inputman.richtexteditor/JS/plugins/htmlcode/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/image': 'npm:@mescius/inputman.richtexteditor/JS/plugins/image/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/link': 'npm:@mescius/inputman.richtexteditor/JS/plugins/link/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/lists': 'npm:@mescius/inputman.richtexteditor/JS/plugins/lists/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/media': 'npm:@mescius/inputman.richtexteditor/JS/plugins/media/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/pagebreak': 'npm:@mescius/inputman.richtexteditor/JS/plugins/pagebreak/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/preview': 'npm:@mescius/inputman.richtexteditor/JS/plugins/preview/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/save': 'npm:@mescius/inputman.richtexteditor/JS/plugins/save/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/searchreplace': 'npm:@mescius/inputman.richtexteditor/JS/plugins/searchreplace/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/table': 'npm:@mescius/inputman.richtexteditor/JS/plugins/table/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/template': 'npm:@mescius/inputman.richtexteditor/JS/plugins/template/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/wordcount': 'npm:@mescius/inputman.richtexteditor/JS/plugins/wordcount/plugin.js', '@mescius/inputman.comment': 'npm:@mescius/inputman.comment/index.js', '@mescius/inputman.comment/CSS': 'npm:@mescius/inputman.comment/CSS', '@mescius/wijmo': 'npm:@mescius/wijmo/index.js', '@mescius/wijmo.styles': 'npm:@mescius/wijmo.styles', '@mescius/wijmo.cultures': 'npm:@mescius/wijmo.cultures', '@mescius/wijmo.input': 'npm:@mescius/wijmo.input/index.js', '@mescius/wijmo.grid': 'npm:@mescius/wijmo.grid/index.js', '@mescius/wijmo.nav': 'npm:@mescius/wijmo.nav/index.js', '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-resources-ja': 'npm:@mescius/spread-sheets-resources-ja/index.js', '@mescius/spread-sheets/styles': 'npm:@mescius/spread-sheets/styles', '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' }, } });