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

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.

主站蜘蛛池模板: 文水县| 新巴尔虎右旗| 彰化市| 泰顺县| 邓州市| 临湘市| 乃东县| 定远县| 崇仁县| 兴国县| 房产| 武功县| 扎赉特旗| 冕宁县| 河曲县| 阜城县| 淮北市| 浠水县| 宁化县| 吐鲁番市| 天镇县| 长泰县| 电白县| 沙洋县| 北宁市| 兰西县| 奉新县| 永仁县| 宝应县| 南部县| 深水埗区| 凌源市| 张家口市| 彰化县| 清涧县| 商南县| 南平市| 普格县| 木兰县| 肃宁县| 泰安市|