Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
5333aa72
Commit
5333aa72
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[dome] fix fontSize in editors
parent
8f72b112
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ivette/src/dome/src/renderer/text/editors.js
+69
-59
69 additions, 59 deletions
ivette/src/dome/src/renderer/text/editors.js
ivette/src/dome/src/renderer/text/style.css
+1
-1
1 addition, 1 deletion
ivette/src/dome/src/renderer/text/style.css
with
70 additions
and
60 deletions
ivette/src/dome/src/renderer/text/editors.js
+
69
−
59
View file @
5333aa72
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
Dome
from
'
dome
'
;
import
*
as
Dome
from
'
dome
'
;
import
{
Vfill
}
from
'
dome/layout/boxes
'
;
import
CodeMirror
from
'
codemirror/lib/codemirror.js
'
;
import
CodeMirror
from
'
codemirror/lib/codemirror.js
'
;
import
'
./style.css
'
;
import
'
./style.css
'
;
...
@@ -19,62 +20,10 @@ const CSS_HOVERED = 'dome-xText-hover' ;
...
@@ -19,62 +20,10 @@ const CSS_HOVERED = 'dome-xText-hover' ;
const
CSS_SELECTED
=
'
dome-xText-select
'
;
const
CSS_SELECTED
=
'
dome-xText-select
'
;
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// ---
Text View
// ---
Code Mirror Instance Wrapper
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/**
class
CodeMirrorWrapper
extends
React
.
Component
{
@class
@summary Rich Text Editor.
@property {Buffer} buffer - associated Buffer holding the text content
@property {string} className - additional class name(s)
@property {object} style - additional CSS style
@property {number} fontSize - editor font-size
@property {string} selection - currently selected markder identifier
@property {function} onSelection - callback used when an identified marker is clicked
@property {function} onContextMenu - selection callback on right-click
@property {object} [...options] - additional CodeMirror
[configuration](https://codemirror.net/doc/manual.html#config) properties
@description
A component rendering the content of a text buffer, that shall be instances
of the `Buffer` base class.
The view is based on a [CodeMirror](https://codemirror.net) component linked with
the internal Code Mirror Document from the associated buffer.
Multiple views might share the same buffer as source content. The buffer will be
kept in sync with all its linked views.
The Text component never update its mounted NODE element, however, all property
modifications (including buffer) are propagated to the internal CodeMirror instance.
Undefined properties are set (or reset) to the CodeMirror defaults.
##### Themes
The CodeMirror `theme` option allow you to style your document,
especially when using modes.
Themes are only accessible if you load the associated CSS style sheet.
For instance, to use the `'ambiance'` theme provided with CodeMirror, you shall
import `'codemirror/theme/ambiance.css'` somewhere in your application.
##### Modes & Adds-On
You can install modes and adds-on provided by the CodeMirror distribution by
simply importing (once, before being used) the associated modules in your
application. For instance, to use the `'javascript'` mode option, you shall
import `'codemirror/mode/javascript/javascript.js'` file in your application.
##### Further Customization
You can register your own extensions directly into the global `CodeMirror`
class instance. However, the correct instance must be retrieved by using
`import CodeMirror from 'codemirror/lib/codemirror.js'` ; using `from
'codemirror'` returns a different instance of `CodeMirror` class and will
not work.
*/
export
class
Text
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -372,12 +321,8 @@ export class Text extends React.Component {
...
@@ -372,12 +321,8 @@ export class Text extends React.Component {
}
}
render
()
{
render
()
{
const
{
className
,
fontSize
,
style
}
=
this
.
props
;
const
theStyle
=
Object
.
assign
(
{}
,
style
);
if
(
fontSize
)
theStyle
.
fontSize
=
fontSize
;
return
(
return
(
<
div
className
=
{
'
dome-xText
'
+
className
}
<
div
className
=
{
'
dome-xText
'
}
style
=
{
theStyle
}
ref
=
{
this
.
mountPoint
}
ref
=
{
this
.
mountPoint
}
onClick
=
{
this
.
onClick
}
onClick
=
{
this
.
onClick
}
onContextMenu
=
{
this
.
onContextMenu
}
onContextMenu
=
{
this
.
onContextMenu
}
...
@@ -391,3 +336,68 @@ export class Text extends React.Component {
...
@@ -391,3 +336,68 @@ export class Text extends React.Component {
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// --- Text View
// --------------------------------------------------------------------------
/**
@class
@summary Rich Text Editor.
@property {Buffer} buffer - associated Buffer holding the text content
@property {string} className - additional class name(s)
@property {object} style - additional CSS style
@property {number} fontSize - editor font-size
@property {string} selection - currently selected markder identifier
@property {function} onSelection - callback used when an identified marker is clicked
@property {function} onContextMenu - selection callback on right-click
@property {object} [...options] - additional CodeMirror
[configuration](https://codemirror.net/doc/manual.html#config) properties
@description
A component rendering the content of a text buffer, that shall be instances
of the `Buffer` base class.
The view is based on a [CodeMirror](https://codemirror.net) component linked with
the internal Code Mirror Document from the associated buffer.
Multiple views might share the same buffer as source content. The buffer will be
kept in sync with all its linked views.
The Text component never update its mounted NODE element, however, all property
modifications (including buffer) are propagated to the internal CodeMirror instance.
Undefined properties are set (or reset) to the CodeMirror defaults.
##### Themes
The CodeMirror `theme` option allow you to style your document,
especially when using modes.
Themes are only accessible if you load the associated CSS style sheet.
For instance, to use the `'ambiance'` theme provided with CodeMirror, you shall
import `'codemirror/theme/ambiance.css'` somewhere in your application.
##### Modes & Adds-On
You can install modes and adds-on provided by the CodeMirror distribution by
simply importing (once, before being used) the associated modules in your
application. For instance, to use the `'javascript'` mode option, you shall
import `'codemirror/mode/javascript/javascript.js'` file in your application.
##### Further Customization
You can register your own extensions directly into the global `CodeMirror`
class instance. However, the correct instance must be retrieved by using
`import CodeMirror from 'codemirror/lib/codemirror.js'` ; using `from
'codemirror'` returns a different instance of `CodeMirror` class and will
not work.
*/
export
function
Text
({
className
,
style
,
fontSize
,
...
props
})
{
const
theStyle
=
Object
.
assign
(
{}
,
style
);
if
(
fontSize
)
theStyle
.
fontSize
=
fontSize
;
return
(
<
Vfill
className
=
{
className
}
style
=
{
theStyle
}
>
<
CodeMirrorWrapper
{...
props
}
/
>
<
/Vfill
>
);
}
// --------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
ivette/src/dome/src/renderer/text/style.css
+
1
−
1
View file @
5333aa72
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
.dome-xText
.CodeMirror
{
.dome-xText
.CodeMirror
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
line-height
:
1.
0
!important
;
line-height
:
1.
2
!important
;
text-shadow
:
none
!important
;
text-shadow
:
none
!important
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment