官术网_书友最值得收藏!

Fitting the screen size

If you keep experimenting with your application at runtime, you may notice that the editor component doesn't fit the whole application area once you start resizing the window or maximizing it. To address this, we need to add some CSS styles to tell the component it needs to fit the parent width and height.

Please note that, at the lower level, SimpleMDE wraps another great component called CodeMirror.

CodeMirror is a versatile text editor that's implemented in JavaScript for the browser. It is specialized for editing code and comes with a number of language modes and addons that implement more advanced editing functionality.

Here, we are going to add flex layout features to the whole body of the HTML base and add some styling support for the CodeMirror part, which is part of SimpleMDE. Let's get started:

  1. Update the styles in the index.html file according to the following code:
      <style>
html, body {
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
}

.CodeMirror {
flex: 1;
}
</style>
  1. Run the application and try resizing the window to make it wider or taller. Notice that, now, the markdown editor area perfectly fits the entire page area:

Now, let's move on to integrating the application menu.

主站蜘蛛池模板: 南乐县| 汉源县| 北票市| 伊金霍洛旗| 景谷| 蒙山县| 华安县| 庆阳市| 顺义区| 罗甸县| 太白县| 唐山市| 南丰县| 壶关县| 铜山县| 阳谷县| 成武县| 南乐县| 临西县| 张家川| 景泰县| 亚东县| 德州市| 星子县| 离岛区| 虎林市| 安岳县| 六盘水市| 启东市| 夏津县| 类乌齐县| 太仆寺旗| 吴忠市| 五莲县| 台南县| 营山县| 仙居县| 高碑店市| 洪湖市| 延寿县| 安新县|