mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
rework prompts to show up in input panes
This commit is contained in:
parent
781e8310f5
commit
8a8528a1cb
3 changed files with 28 additions and 10 deletions
|
|
@ -116,11 +116,16 @@ label {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
.inputfieldwrapper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.inputsend {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
height: inherit;
|
||||
height: 100%;
|
||||
width: 30px;
|
||||
color: white;
|
||||
background-color: black;
|
||||
|
|
@ -128,9 +133,7 @@ label {
|
|||
}
|
||||
|
||||
.inputfield {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: inherit;
|
||||
height: 100%;
|
||||
width: calc(100% - 30px);
|
||||
background-color: black;
|
||||
color: white;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,19 @@ let defaultout_plugin = (function () {
|
|||
//
|
||||
// By default just show the prompt.
|
||||
var onPrompt = function (args, kwargs) {
|
||||
// show prompt
|
||||
$('#prompt')
|
||||
.addClass("out")
|
||||
.html(args[0]);
|
||||
// show prompt on every input pane
|
||||
var prompts = $('.prompt');
|
||||
|
||||
for( var x=0; x < prompts.length; x++ ) {
|
||||
var prmpt = $( prompts[x] );
|
||||
var sibling = prmpt.siblings().first();
|
||||
|
||||
prmpt.addClass("out")
|
||||
.html(args[0])
|
||||
.css({'height':'1.5em'});
|
||||
|
||||
sibling.css({'height':'calc(100% - 1.5em)'});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -476,6 +476,7 @@ let goldenlayout = (function () {
|
|||
|
||||
myLayout = new GoldenLayout( window.goldenlayout_config, mainsub );
|
||||
|
||||
$("#prompt").remove(); // remove the HTML-defined prompt div
|
||||
$("#inputcontrol").remove(); // remove the cluttered, HTML-defined input divs
|
||||
|
||||
// register our component and replace the default messagewindow with the Main component
|
||||
|
|
@ -486,11 +487,16 @@ let goldenlayout = (function () {
|
|||
|
||||
// register our new input component
|
||||
myLayout.registerComponent( "input", function (container, componentState) {
|
||||
var inputfield = $("<textarea type='text' class='inputfield form-control'></textarea>");
|
||||
var promptfield = $("<div class='prompt'></div>");
|
||||
var formcontrol = $("<textarea type='text' class='inputfield form-control'></textarea>");
|
||||
var button = $("<button type='button' class='inputsend'>></button>");
|
||||
|
||||
var inputfield = $("<div class='inputfieldwrapper'>")
|
||||
.append( button )
|
||||
.append( formcontrol );
|
||||
|
||||
$("<div class='inputwrap'>")
|
||||
.append( button )
|
||||
.append( promptfield )
|
||||
.append( inputfield )
|
||||
.appendTo( container.getElement() );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue