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

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.

主站蜘蛛池模板: 子长县| 旬阳县| 耒阳市| 扶余县| 宁都县| 德化县| 白城市| 常州市| 江达县| 金沙县| 清水县| 北碚区| 措美县| 德州市| 拜泉县| 健康| 大关县| 东乡族自治县| 剑川县| 阿合奇县| 盐山县| 扎囊县| 天台县| 阿坝| 龙岩市| 彭州市| 普洱| 开鲁县| 南宁市| 铜川市| 石林| 武威市| 琼中| 柳林县| 莱州市| 崇仁县| 南昌市| 新绛县| 宣汉县| 尼玛县| 崇文区|