Laravel 5.3 blade 是否支持 <font> 标签?
Does Laravel 5.3 blade supports <font> tag?
当我输入
<font> test </font>
在 laravel blade 文件中 chrome 没有呈现任何内容。
编辑:请不要只建议不要使用字体标签,请阅读整个问题。这个字体标签是由所见即所得的编辑器summernote生成的,所以我选择不使用它。
奇怪的是,我在页面源代码中看到了这个标记,但它没有呈现在页面上。当我制作具有相同来源的本地 html 文件时 - 它在 Chrome 中的字体标签内显示文本。
此外,当我转到开发人员工具元素并单击容器 div 以编辑为 html 时,如果我在任何地方添加任何内容,然后所有字体标签都会突然出现。 Firefox 中的行为完全相同。如果我不在检查器中编辑页面,无论我刷新多少次,字体标签都不会显示。
这是我的 blade 文件:
@extends('layouts.app')
@section('content')
<font> test </font>
<p> <a href="/articles"><-Back</a></p>
<p> Selected article: {{$article->title}} </p>
<p> Description: {{$article->description}} </p>
<p><img src="/{{$article->image}}" width="600px" alt="ASD"></p>
<font> ojo </font>
{!! $article->body !!}
<p>ge?</p>
@stop
<font></font>
在 HTML 4.01 中与仅与样式相关的所有元素同时弃用,然后在 HTML5 中弃用。
这与laravel.
无关
可以实现 <font>
元素之前的行为,使用 CSS Fonts CSS 属性甚至可以更好地控制
See more information on <font>
here.
编辑
我答错了你的问题,http://summernote.org/ 正在生成 <font>
标签。您可以在每次输入 summernote 时替换它。像这样:
(可能需要一些调整)
//some dynamic elements have to be triggered from the body
$body = $(document.body);
//container where font excists
$container = $('.container')
//less code to type
function observe(element, event, handler) {
$body.on(event, element, handler)
}
//delay 0 to speed up
function delay_func() {
window.setTimeout(font_to_span(), 0);
}
//replace font tags with span and extract the font family
function font_to_span() {
$font = $container.find('font');
font_family = $font.attr('face');
$font.replaceWith(function() {
return $("<span />", {
html: $(this).html(),
style: 'font-family:' + font_family + ';'
});
});
}
//add events to trigger font finder_to_span on
observe($container, 'change', font_to_span);
observe($container, 'cut', delay_func);
observe($container, 'paste', delay_func);
observe($container, 'drop', delay_func);
observe($container, 'keydown', delay_func);
font_to_span();
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div class="container">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce feugiat, sapien sed tempor dignissim, mi metus tempor enim, <font face="Comic Sans MS">a vestibulum nulla tortor</font> posuere tellus. Etiam eu dolor ut dui viverra dictum non non justo. Duis
blandit in enim vitae mollis. Integer euismod lectus ut turpis fermentum, eget rutrum urna ornare.</div>
我找到了导致这种行为的原因,我应该早点意识到,如果它看起来像魔术 - 它 javascript。
所以在基本 Laravel 5.3 blade 页面中,我们在源代码中有字体标签,我们可以在前端的页面源代码中看到它,但它们在页面上不可见。原因是因为 Laravel 5.3 默认包含 Vue javascript 框架,包括包含 Vue 的 app.js,它在文档加载时运行一些 Vue 魔法,所以字体标签由于某种原因被隐藏 - 可能相关被弃用。
我暂时从我的 Laravel 应用程序中删除了 Vue(通过删除包含它的 js 代码)并且字体标签又回来了。
当我输入
<font> test </font>
在 laravel blade 文件中 chrome 没有呈现任何内容。
编辑:请不要只建议不要使用字体标签,请阅读整个问题。这个字体标签是由所见即所得的编辑器summernote生成的,所以我选择不使用它。
奇怪的是,我在页面源代码中看到了这个标记,但它没有呈现在页面上。当我制作具有相同来源的本地 html 文件时 - 它在 Chrome 中的字体标签内显示文本。 此外,当我转到开发人员工具元素并单击容器 div 以编辑为 html 时,如果我在任何地方添加任何内容,然后所有字体标签都会突然出现。 Firefox 中的行为完全相同。如果我不在检查器中编辑页面,无论我刷新多少次,字体标签都不会显示。
这是我的 blade 文件:
@extends('layouts.app')
@section('content')
<font> test </font>
<p> <a href="/articles"><-Back</a></p>
<p> Selected article: {{$article->title}} </p>
<p> Description: {{$article->description}} </p>
<p><img src="/{{$article->image}}" width="600px" alt="ASD"></p>
<font> ojo </font>
{!! $article->body !!}
<p>ge?</p>
@stop
<font></font>
在 HTML 4.01 中与仅与样式相关的所有元素同时弃用,然后在 HTML5 中弃用。
这与laravel.
可以实现 <font>
元素之前的行为,使用 CSS Fonts CSS 属性甚至可以更好地控制
See more information on <font>
here.
编辑
我答错了你的问题,http://summernote.org/ 正在生成 <font>
标签。您可以在每次输入 summernote 时替换它。像这样:
(可能需要一些调整)
//some dynamic elements have to be triggered from the body
$body = $(document.body);
//container where font excists
$container = $('.container')
//less code to type
function observe(element, event, handler) {
$body.on(event, element, handler)
}
//delay 0 to speed up
function delay_func() {
window.setTimeout(font_to_span(), 0);
}
//replace font tags with span and extract the font family
function font_to_span() {
$font = $container.find('font');
font_family = $font.attr('face');
$font.replaceWith(function() {
return $("<span />", {
html: $(this).html(),
style: 'font-family:' + font_family + ';'
});
});
}
//add events to trigger font finder_to_span on
observe($container, 'change', font_to_span);
observe($container, 'cut', delay_func);
observe($container, 'paste', delay_func);
observe($container, 'drop', delay_func);
observe($container, 'keydown', delay_func);
font_to_span();
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<div class="container">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce feugiat, sapien sed tempor dignissim, mi metus tempor enim, <font face="Comic Sans MS">a vestibulum nulla tortor</font> posuere tellus. Etiam eu dolor ut dui viverra dictum non non justo. Duis
blandit in enim vitae mollis. Integer euismod lectus ut turpis fermentum, eget rutrum urna ornare.</div>
我找到了导致这种行为的原因,我应该早点意识到,如果它看起来像魔术 - 它 javascript。
所以在基本 Laravel 5.3 blade 页面中,我们在源代码中有字体标签,我们可以在前端的页面源代码中看到它,但它们在页面上不可见。原因是因为 Laravel 5.3 默认包含 Vue javascript 框架,包括包含 Vue 的 app.js,它在文档加载时运行一些 Vue 魔法,所以字体标签由于某种原因被隐藏 - 可能相关被弃用。
我暂时从我的 Laravel 应用程序中删除了 Vue(通过删除包含它的 js 代码)并且字体标签又回来了。